obtainAccessCredentialsViaServiceAccount function

Future<AccessCredentials> obtainAccessCredentialsViaServiceAccount(
  1. ServiceAccountCredentials clientCredentials,
  2. List<String> scopes,
  3. Client client
)

Obtain oauth2 AccessCredentials using service account credentials.

In case the service account has no access to the requested scopes or another error occurs the returned future will complete with an Exception.

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

The ServiceAccountCredentials can be obtained in the Google Cloud Console.

Implementation

Future<AccessCredentials> obtainAccessCredentialsViaServiceAccount(
  ServiceAccountCredentials clientCredentials,
  List<String> scopes,
  Client client,
) =>
    JwtFlow(
      clientCredentials.email,
      clientCredentials.privateRSAKey,
      clientCredentials.impersonatedUser,
      scopes,
      client,
    ).run();