public class AppIdentityCredential implements HttpRequestInitializer, HttpExecuteInterceptorOAuth 2.0 credential in which a client Google App Engine application needs to access data that it owns, based on <a href="https://developers.google.com/appengine/docs/java/appidentity/
Java_Asserting_identity_to_Google_APIs">Asserting Identity to Google APIs
Intercepts the request by using the access token obtained from AppIdentityService#getAccessToken(Iterable).
Sample usage:
public static HttpRequestFactory createRequestFactory(HttpTransport transport,
JsonFactory jsonFactory, TokenResponse tokenResponse) {
return transport.createRequestFactory(
new AppIdentityCredential("https://www.googleapis.com/auth/urlshortener"));
}
Implementation is immutable and thread-safe.
Implements
com.google.api.client.http.HttpRequestInitializer, com.google.api.client.http.HttpExecuteInterceptorConstructors
AppIdentityCredential(AppIdentityCredential.Builder builder)
protected AppIdentityCredential(AppIdentityCredential.Builder builder)| Name | Description |
| builder | AppIdentityCredential.Builderbuilder |
AppIdentityCredential(Collection<String> scopes)
public AppIdentityCredential(Collection<String> scopes)| Name | Description |
| scopes | Collection<String>OAuth scopes |
Methods
getAppIdentityService()
public final AppIdentityService getAppIdentityService()Gets the App Identity Service that provides the access token.
| Type | Description |
| com.google.appengine.api.appidentity.AppIdentityService |
getScopes()
public final Collection<String> getScopes()Gets the OAuth scopes (unmodifiable).
| Type | Description |
| Collection<String> |
initialize(HttpRequest request)
public void initialize(HttpRequest request)| Name | Description |
| request | com.google.api.client.http.HttpRequest |
| Type | Description |
| IOException |
intercept(HttpRequest request)
public void intercept(HttpRequest request)| Name | Description |
| request | com.google.api.client.http.HttpRequest |
| Type | Description |
| IOException |