obtainAccessCredentialsViaMetadataServer function
Obtain oauth2 AccessCredentials using the metadata API on ComputeEngine.
In case the VM was not configured with access to the requested scopes or an
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.
No credentials are needed. But this function is only intended to work on a Google Compute Engine VM with configured access to Google APIs.
Implementation
Future<AccessCredentials> obtainAccessCredentialsViaMetadataServer(
Client client,
) =>
MetadataServerAuthorizationFlow(client).run();