requestAccessToken method

Future<AccessTokenResponse> requestAccessToken({
  1. required String code,
  2. required String clientId,
  3. String? clientSecret,
  4. String? codeVerifier,
  5. List<String>? scopes,
  6. Map<String, dynamic>? customParams,
  7. dynamic httpClient,
})

Requests and Access Token using the provided Authorization code.

Implementation

Future<AccessTokenResponse> requestAccessToken(
    {required String code,
    required String clientId,
    String? clientSecret,
    String? codeVerifier,
    List<String>? scopes,
    Map<String, dynamic>? customParams,
    httpClient}) async {
  final params = getTokenUrlParams(
      code: code,
      redirectUri: redirectUri,
      codeVerifier: codeVerifier,
      customParams: customParams);

  var response = await _performAuthorizedRequest(
      url: tokenUrl,
      clientId: clientId,
      clientSecret: clientSecret,
      params: params,
      headers: _accessTokenRequestHeaders,
      httpClient: httpClient);

  return http2TokenResponse(response, requestedScopes: scopes);
}