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.
Static Fields
TOKEN_SERVER_ENCODED_URL
public static final String TOKEN_SERVER_ENCODED_URL
Metadata Service Account token server encoded URL.
Field Value | |
---|---|
Type | Description |
String |
Constructors
ComputeCredential(ComputeCredential.Builder builder)
protected ComputeCredential(ComputeCredential.Builder builder)
Parameter | |
---|---|
Name | Description |
builder |
ComputeCredential.Builder builder |
ComputeCredential(HttpTransport transport, JsonFactory jsonFactory)
public ComputeCredential(HttpTransport transport, JsonFactory jsonFactory)
Parameters | |
---|---|
Name | Description |
transport |
com.google.api.client.http.HttpTransport HTTP transport |
jsonFactory |
com.google.api.client.json.JsonFactory JSON factory |
Methods
executeRefreshToken()
protected TokenResponse executeRefreshToken()
Returns | |
---|---|
Type | Description |
com.google.api.client.auth.oauth2.TokenResponse |
com.google.api.client.auth.oauth2.Credential.executeRefreshToken()
Exceptions | |
---|---|
Type | Description |
IOException |