Class ComputeCredential (1.35.0)

public class ComputeCredential extends Credential

Beta
Google Compute Engine service accounts OAuth 2.0 credential based on Authenticating from Google Compute Engine.

Sample usage:


 public static HttpRequestFactory createRequestFactory(
     HttpTransport transport, JsonFactory jsonFactory) {
   return transport.createRequestFactory(
     new GoogleComputeCredential(transport, jsonFactory));
 }
 

Implementation is immutable and thread-safe.

Inheritance

java.lang.Object > com.google.api.client.auth.oauth2.Credential > ComputeCredential

Static Fields

TOKEN_SERVER_ENCODED_URL

public static final String TOKEN_SERVER_ENCODED_URL

Metadata Service Account token server encoded URL.

Field Value
TypeDescription
String

Constructors

ComputeCredential(ComputeCredential.Builder builder)

protected ComputeCredential(ComputeCredential.Builder builder)
Parameter
NameDescription
builderComputeCredential.Builder

builder

ComputeCredential(HttpTransport transport, JsonFactory jsonFactory)

public ComputeCredential(HttpTransport transport, JsonFactory jsonFactory)
Parameters
NameDescription
transportcom.google.api.client.http.HttpTransport

HTTP transport

jsonFactorycom.google.api.client.json.JsonFactory

JSON factory

Methods

executeRefreshToken()

protected TokenResponse executeRefreshToken()
Returns
TypeDescription
com.google.api.client.auth.oauth2.TokenResponse
Overrides
com.google.api.client.auth.oauth2.Credential.executeRefreshToken()
Exceptions
TypeDescription
IOException