exchangeOAuthAuthorizationCode<TProfile extends Object> function
Future<OAuthTokenResponse>
exchangeOAuthAuthorizationCode<TProfile extends Object>(
- OAuthProvider<
TProfile> provider, { - required String code,
- String? codeVerifier,
- Client? httpClient,
Exchanges an authorization code for provider tokens.
Implementation
Future<OAuthTokenResponse>
exchangeOAuthAuthorizationCode<TProfile extends Object>(
OAuthProvider<TProfile> provider, {
required String code,
String? codeVerifier,
http.Client? httpClient,
}) {
final scope = provider.scopes.isEmpty ? null : provider.scopes.join(' ');
return oauthClientForProvider(
provider,
httpClient: httpClient,
).exchangeAuthorizationCode(
code: code,
redirectUri: Uri.parse(provider.redirectUri),
codeVerifier: codeVerifier,
scope: scope,
additionalParameters: provider.tokenParams.isEmpty
? null
: <String, String>{
for (final entry in provider.tokenParams.entries)
if (!_oauthTokenReservedParameters.contains(entry.key))
entry.key: entry.value,
},
);
}