Skip to content

Commit

Permalink
update client secret requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanoltman committed Feb 27, 2024
1 parent 87a1d29 commit 6544dba
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions googleapis_auth/lib/src/auth_functions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,6 @@ Future<AccessCredentials> refreshCredentials(
Client client, {
AuthEndpoints authEndpoints = const GoogleAuthEndpoints(),
}) async {
final secret = clientId.secret;
if (secret == null) {
throw ArgumentError('clientId.secret cannot be null.');
}

final refreshToken = credentials.refreshToken;
if (refreshToken == null) {
throw ArgumentError('clientId.refreshToken cannot be null.');
Expand All @@ -122,7 +117,9 @@ Future<AccessCredentials> refreshCredentials(
final jsonMap = await client.oauthTokenRequest(
{
'client_id': clientId.identifier,
'client_secret': secret,
// Not all providers require a client secret,
// e.g. https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow#refresh-the-access-token
if (clientId.secret != null) 'client_secret': clientId.secret!,
'refresh_token': refreshToken,
'grant_type': 'refresh_token',
},
Expand Down

0 comments on commit 6544dba

Please sign in to comment.