clientAuthorizationTokensForScopes method

  1. @override
Future<ClientAuthorizationTokenData?> clientAuthorizationTokensForScopes(
  1. ClientAuthorizationTokensForScopesParameters params
)
override

Returns the tokens used to authenticate other API calls from a client.

This should only return null if prompting would be necessary but params do not allow it, otherwise any failure should return an error.

Implementation

@override
Future<ClientAuthorizationTokenData?> clientAuthorizationTokensForScopes(
  ClientAuthorizationTokensForScopesParameters params,
) async {
  await _initialized;
  _validateScopes(params.request.scopes);

  final String? token = await _gisSdkClient.requestScopes(
    params.request.scopes,
    promptIfUnauthorized: params.request.promptIfUnauthorized,
    userHint: params.request.userId,
  );
  return token == null
      ? null
      : ClientAuthorizationTokenData(accessToken: token);
}