getTokenWithSocialGrantFlow method
Requests an Access Token to the OAuth2 endpoint using the Social Grant flow.
Implementation
Future<AccessTokenResponse> getTokenWithSocialGrantFlow(
{required String clientId,
required String clientSecret,
List<String>? scopes,
required String providerName,
required String providerAccessToken,
httpClient}) async {
var params = <String, String>{
'grant_type': 'social',
'provider': providerName!,
'access_token': providerAccessToken!
};
if (scopes != null && scopes.isNotEmpty) {
params['scope'] = serializeScopes(scopes);
}
var response = await _performAuthorizedRequest(
url: tokenUrl,
clientId: clientId,
clientSecret: clientSecret,
params: params,
httpClient: httpClient);
return http2TokenResponse(response, requestedScopes: scopes);
}