2.9.3 (latest) 2.9.2 2.8.1 2.7.2 2.6.0 2.5.1 2.4.1 2.1.2 2.0.1 1.35.2 1.34.1 1.33.4

```java
public class AppIdentityCredential implements HttpRequestInitializer, HttpExecuteInterceptor
```
OAuth 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:

```java

 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.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> AppIdentityCredential

## Implements

com.google.api.client.http.HttpRequestInitializer, com.google.api.client.http.HttpExecuteInterceptor

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-java.lang.Object-) [Object.finalize()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#finalize--) [Object.getClass()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#getClass--) [Object.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [Object.notify()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notify--) [Object.notifyAll()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#notifyAll--) [Object.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [Object.wait()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait--) [Object.wait(long)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-) [Object.wait(long,int)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#wait-long-int-)

## Constructors

### AppIdentityCredential(AppIdentityCredential.Builder builder)

```java
protected AppIdentityCredential(AppIdentityCredential.Builder builder)
```

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `builder` | `AppIdentityCredential.Builder` builder |

### AppIdentityCredential(Collection\<String\> scopes)

```java
public AppIdentityCredential(Collection<String> scopes)
```

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `scopes` | `Collection<String>` OAuth scopes |

## Methods

### getAppIdentityService()

```java
public final AppIdentityService getAppIdentityService()
```
Gets the App Identity Service that provides the access token.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `com.google.appengine.api.appidentity.AppIdentityService` |   |

### getScopes()

```java
public final Collection<String> getScopes()
```
Gets the OAuth scopes (unmodifiable).

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Collection<String>` |   |

### initialize(HttpRequest request)

```java
public void initialize(HttpRequest request)
```

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `com.google.api.client.http.HttpRequest` |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `IOException` |   |

### intercept(HttpRequest request)

```java
public void intercept(HttpRequest request)
```

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `com.google.api.client.http.HttpRequest` |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `IOException` |   |