public class AppIdentityCredential extends Object implements com.google.api.client.http.HttpRequestInitializer, com.google.api.client.http.HttpExecuteInterceptor
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.
Modifier and Type | Class and Description |
---|---|
static class |
AppIdentityCredential.AppEngineCredentialWrapper
Beta Credential wrapper for application identity that inherits from GoogleCredential. |
static class |
AppIdentityCredential.Builder
Builder for
AppIdentityCredential . |
Modifier | Constructor and Description |
---|---|
protected |
AppIdentityCredential(AppIdentityCredential.Builder builder) |
|
AppIdentityCredential(Collection<String> scopes) |
Modifier and Type | Method and Description |
---|---|
AppIdentityService |
getAppIdentityService()
Gets the App Identity Service that provides the access token.
|
Collection<String> |
getScopes()
Gets the OAuth scopes (unmodifiable).
|
void |
initialize(com.google.api.client.http.HttpRequest request) |
void |
intercept(com.google.api.client.http.HttpRequest request) |
public AppIdentityCredential(Collection<String> scopes)
scopes
- OAuth scopesprotected AppIdentityCredential(AppIdentityCredential.Builder builder)
builder
- builderpublic void initialize(com.google.api.client.http.HttpRequest request) throws IOException
initialize
in interface com.google.api.client.http.HttpRequestInitializer
IOException
public void intercept(com.google.api.client.http.HttpRequest request) throws IOException
intercept
in interface com.google.api.client.http.HttpExecuteInterceptor
IOException
public final AppIdentityService getAppIdentityService()
public final Collection<String> getScopes()
Copyright © 2010–2019 Google. All rights reserved.