clientViaServiceAccount function
Future<AutoRefreshingAuthClient>
clientViaServiceAccount(
- ServiceAccountCredentials clientCredentials,
- List<
String> scopes, { - Client? baseClient,
- String? quotaProject,
Obtains oauth2 credentials and returns an authenticated HTTP client.
See obtainAccessCredentialsViaServiceAccount for specifics about the arguments used for obtaining access credentials.
Returns an AutoRefreshingAuthClient that will automatically refresh the AccessCredentials before they expire.
If baseClient is provided, all HTTP requests will be made with it.
Otherwise, a new Client instance will be created.
The user is responsible for closing the returned HTTP Client.
Closing the returned Client will not close baseClient.
If quotaProject is provided, it will be added to the X-Goog-User-Project
header for all requests.
Otherwise, the ServiceAccountCredentials.quotaProject property on
clientCredentials will be used.
Implementation
Future<AutoRefreshingAuthClient> clientViaServiceAccount(
ServiceAccountCredentials clientCredentials,
List<String> scopes, {
Client? baseClient,
String? quotaProject,
}) async => await clientFromFlow(
(c) => JwtFlow(
clientCredentials.email,
clientCredentials.privateRSAKey,
clientCredentials.impersonatedUser,
scopes,
c,
),
baseClient: baseClient,
quotaProject: quotaProject ?? clientCredentials.quotaProject,
);