Skip to content

Commit 1a553d9

Browse files
committed
Fix Authentication Detection Order
Previously if you configured a "ClientID" and "ClientSecret" value it would assume you wanted Password Limited OAuth even if you configured it to use your own token source. Fix that up by configuring password limited last.
1 parent 01447ae commit 1a553d9

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

src/Aydsko.iRacingData/Package Release Notes.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
============================
2+
Release Notes for 2601.1.0
3+
============================
4+
5+
FIXES / NEW IMPLEMENTATIONS:
6+
- Changed detection order so the internal "Password Limited Grant" implementation doesn't override a "UseOAuthTokenSource(...)" call when both "ClientId" and "ClientSecret" are defined on the options.
7+
18
============================
29
Release Notes for 2601.0.0
310
============================

src/Aydsko.iRacingData/ServicesExtensions.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,15 +109,15 @@ internal static IHttpClientBuilder AddIRacingDataApiInternal(this IServiceCollec
109109
{
110110
httpClientBuilder = services.AddHttpClient<IAuthenticatingHttpClient, OAuthCallbackAuthenticatingApiClient>();
111111
}
112-
else if (!string.IsNullOrWhiteSpace(options.ClientId) && !string.IsNullOrWhiteSpace(options.ClientSecret))
113-
{
114-
httpClientBuilder = services.AddHttpClient<IAuthenticatingHttpClient, PasswordLimitedOAuthAuthenticatingHttpClient>();
115-
}
116112
else if (options.TokenSourceFactory is not null)
117113
{
118114
services.AddTransient(options.TokenSourceFactory);
119115
httpClientBuilder = services.AddHttpClient<IAuthenticatingHttpClient, OAuthTokenSourceApiClient>();
120116
}
117+
else if (!string.IsNullOrWhiteSpace(options.ClientId) && !string.IsNullOrWhiteSpace(options.ClientSecret))
118+
{
119+
httpClientBuilder = services.AddHttpClient<IAuthenticatingHttpClient, PasswordLimitedOAuthAuthenticatingHttpClient>();
120+
}
121121
else
122122
{
123123
throw new iRacingDataClientException("Invalid configuration for iRacing authentication. You must configure OAuth authentication using the \"UseOAuthTokenSource\" method on the options object.");

0 commit comments

Comments
 (0)