clientViaMetadataServer function

Future<AutoRefreshingAuthClient> clientViaMetadataServer({
  1. Client? baseClient,
})

Obtains oauth2 credentials and returns an authenticated HTTP client.

See obtainAccessCredentialsViaMetadataServer for specifics about the arguments used for obtaining access credentials.

HTTP requests made on the returned client will get an additional Authorization header with the AccessCredentials obtained. Once the AccessCredentials expire, it will use it's refresh token (if available) to obtain new credentials. See autoRefreshingClient for more information.

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.

Implementation

Future<AutoRefreshingAuthClient> clientViaMetadataServer({
  Client? baseClient,
}) async =>
    await clientFromFlow(
      MetadataServerAuthorizationFlow.new,
      baseClient: baseClient,
    );