obtainAccessCredentialsViaUserConsentManual function

Future<AccessCredentials> obtainAccessCredentialsViaUserConsentManual(
  1. ClientId clientId,
  2. List<String> scopes,
  3. Client client,
  4. PromptUserForConsentManual userPrompt, {
  5. String? hostedDomain,
  6. AuthEndpoints authEndpoints = const GoogleAuthEndpoints(),
})

Obtain oauth2 AccessCredentials using the oauth2 authentication code flow.

The clientId that you obtain from the API Console Credentials page, as described in Obtain OAuth 2.0 credentials.

userPrompt will be used for directing the user/user-agent to a URI. See PromptUserForConsentManual for more information.

client will be used for making the HTTP requests needed to create the returned AccessCredentials.

If provided, restricts sign-in to Google Apps hosted accounts at hostedDomain. For more details, see https://developers.google.com/identity/protocols/oauth2/openid-connect#hd-param

The returned Future will complete with AccessCredentials if the user has given the application access to their data. Otherwise, a UserConsentException will be thrown.

Implementation

Future<AccessCredentials> obtainAccessCredentialsViaUserConsentManual(
  ClientId clientId,
  List<String> scopes,
  Client client,
  PromptUserForConsentManual userPrompt, {
  String? hostedDomain,
  AuthEndpoints authEndpoints = const GoogleAuthEndpoints(),
}) =>
    AuthorizationCodeGrantManualFlow(
      authEndpoints,
      clientId,
      scopes,
      client,
      userPrompt,
      hostedDomain: hostedDomain,
    ).run();