2.9.1 (latest) 2.9.0 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

    public static class GoogleAuthorizationCodeFlow.Builder extends AuthorizationCodeFlow.Builder

Google authorization code flow builder.

Implementation is not thread-safe.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder \> GoogleAuthorizationCodeFlow.Builder

## Inherited Members

com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.addRefreshListener(com.google.api.client.auth.oauth2.CredentialRefreshListener) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.build() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.enablePKCE() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.getAuthorizationServerEncodedUrl() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.getClientAuthentication() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.getClientId() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.getClock() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.getCredentialCreatedListener() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.getCredentialDataStore() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.getCredentialStore() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.getJsonFactory() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.getMethod() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.getRefreshListeners() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.getRequestInitializer() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.getScopes() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.getTokenServerUrl() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.getTransport() com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setAuthorizationServerEncodedUrl(java.lang.String) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setClientAuthentication(com.google.api.client.http.HttpExecuteInterceptor) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setClientId(java.lang.String) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setClock(com.google.api.client.util.Clock) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setCredentialCreatedListener(com.google.api.client.auth.oauth2.AuthorizationCodeFlow.CredentialCreatedListener) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setCredentialDataStore(com.google.api.client.util.store.DataStore\<com.google.api.client.auth.oauth2.StoredCredential\>) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setCredentialStore(com.google.api.client.auth.oauth2.CredentialStore) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setDataStoreFactory(com.google.api.client.util.store.DataStoreFactory) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setJsonFactory(com.google.api.client.json.JsonFactory) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setMethod(com.google.api.client.auth.oauth2.Credential.AccessMethod) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setRefreshListeners(java.util.Collection\<com.google.api.client.auth.oauth2.CredentialRefreshListener\>) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setRequestInitializer(com.google.api.client.http.HttpRequestInitializer) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setScopes(java.util.Collection\<java.lang.String\>) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setTokenServerUrl(com.google.api.client.http.GenericUrl) com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setTransport(com.google.api.client.http.HttpTransport) [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

### Builder(HttpTransport transport, JsonFactory jsonFactory, GoogleClientSecrets clientSecrets, Collection\<String\> scopes)

    public Builder(HttpTransport transport, JsonFactory jsonFactory, GoogleClientSecrets clientSecrets, Collection<String> scopes)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `transport` | `com.google.api.client.http.HttpTransport` HTTP transport |
| `jsonFactory` | `com.google.api.client.json.JsonFactory` JSON factory |
| `clientSecrets` | `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets` Google client secrets |
| `scopes` | `https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` collection of scopes to be joined by a space separator |

### Builder(HttpTransport transport, JsonFactory jsonFactory, String clientId, String clientSecret, Collection\<String\> scopes)

    public Builder(HttpTransport transport, JsonFactory jsonFactory, String clientId, String clientSecret, Collection<String> scopes)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `transport` | `com.google.api.client.http.HttpTransport` HTTP transport |
| `jsonFactory` | `com.google.api.client.json.JsonFactory` JSON factory |
| `clientId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` client identifier |
| `clientSecret` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` client secret |
| `scopes` | `https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` collection of scopes to be joined by a space separator (or a single value containing multiple space-separated scopes) |

## Methods

### addRefreshListener(CredentialRefreshListener refreshListener)

    public GoogleAuthorizationCodeFlow.Builder addRefreshListener(CredentialRefreshListener refreshListener)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `refreshListener` | `com.google.api.client.auth.oauth2.CredentialRefreshListener` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.addRefreshListener(com.google.api.client.auth.oauth2.CredentialRefreshListener)

### build()

    public GoogleAuthorizationCodeFlow build()

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.build()

### getAccessType()

    public final String getAccessType()

Returns the access type (`"online"` to request online access or `"offline"` to
request offline access) or `null` for the default behavior of `"online"`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### getApprovalPrompt()

    public final String getApprovalPrompt()

Returns the approval prompt behavior (`"auto"` to request auto-approval or `
"force"` to force the approval UI to show) or `null` for the default behavior of `
"auto"`.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |   |

### setAccessType(String accessType)

    public GoogleAuthorizationCodeFlow.Builder setAccessType(String accessType)

Sets the access type (`"online"` to request online access or `"offline"` to
request offline access) or `null` for the default behavior (`"online"` for web
applications and `"offline"` for installed applications).

By default this has the value `null`.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `accessType` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

### setApprovalPrompt(String approvalPrompt)

    public GoogleAuthorizationCodeFlow.Builder setApprovalPrompt(String approvalPrompt)

Sets the approval prompt behavior (`"auto"` to request auto-approval or `"force"`
to force the approval UI to show) or `null` for the default behavior (`"auto"`
for web applications and `"force"` for installed applications).

By default this has the value `null`.

Overriding is only supported for the purpose of calling the super implementation and
changing the return type, but nothing else.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `approvalPrompt` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

### setAuthorizationServerEncodedUrl(String authorizationServerEncodedUrl)

    public GoogleAuthorizationCodeFlow.Builder setAuthorizationServerEncodedUrl(String authorizationServerEncodedUrl)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `authorizationServerEncodedUrl` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setAuthorizationServerEncodedUrl(java.lang.String)

### setClientAuthentication(HttpExecuteInterceptor clientAuthentication)

    public GoogleAuthorizationCodeFlow.Builder setClientAuthentication(HttpExecuteInterceptor clientAuthentication)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `clientAuthentication` | `com.google.api.client.http.HttpExecuteInterceptor` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setClientAuthentication(com.google.api.client.http.HttpExecuteInterceptor)

### setClientId(String clientId)

    public GoogleAuthorizationCodeFlow.Builder setClientId(String clientId)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `clientId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setClientId(java.lang.String)

### setClock(Clock clock)

    public GoogleAuthorizationCodeFlow.Builder setClock(Clock clock)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `clock` | `com.google.api.client.util.Clock` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setClock(com.google.api.client.util.Clock)

### setCredentialCreatedListener(AuthorizationCodeFlow.CredentialCreatedListener credentialCreatedListener)

    public GoogleAuthorizationCodeFlow.Builder setCredentialCreatedListener(AuthorizationCodeFlow.CredentialCreatedListener credentialCreatedListener)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `credentialCreatedListener` | `com.google.api.client.auth.oauth2.AuthorizationCodeFlow.CredentialCreatedListener` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setCredentialCreatedListener(com.google.api.client.auth.oauth2.AuthorizationCodeFlow.CredentialCreatedListener)

### setCredentialDataStore(DataStore\<StoredCredential\> typedDataStore)

    public GoogleAuthorizationCodeFlow.Builder setCredentialDataStore(DataStore<StoredCredential> typedDataStore)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `typedDataStore` | `com.google.api.client.util.store.DataStore<com.google.api.client.auth.oauth2.StoredCredential>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setCredentialDataStore(com.google.api.client.util.store.DataStore\<com.google.api.client.auth.oauth2.StoredCredential\>)

### setCredentialStore(CredentialStore credentialStore)

    public GoogleAuthorizationCodeFlow.Builder setCredentialStore(CredentialStore credentialStore)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `credentialStore` | `com.google.api.client.auth.oauth2.CredentialStore` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setCredentialStore(com.google.api.client.auth.oauth2.CredentialStore)

### setDataStoreFactory(DataStoreFactory dataStore)

    public GoogleAuthorizationCodeFlow.Builder setDataStoreFactory(DataStoreFactory dataStore)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `dataStore` | `com.google.api.client.util.store.DataStoreFactory` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setDataStoreFactory(com.google.api.client.util.store.DataStoreFactory)

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### setJsonFactory(JsonFactory jsonFactory)

    public GoogleAuthorizationCodeFlow.Builder setJsonFactory(JsonFactory jsonFactory)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `jsonFactory` | `com.google.api.client.json.JsonFactory` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setJsonFactory(com.google.api.client.json.JsonFactory)

### setMethod(Credential.AccessMethod method)

    public GoogleAuthorizationCodeFlow.Builder setMethod(Credential.AccessMethod method)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `method` | `com.google.api.client.auth.oauth2.Credential.AccessMethod` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setMethod(com.google.api.client.auth.oauth2.Credential.AccessMethod)

### setRefreshListeners(Collection\<CredentialRefreshListener\> refreshListeners)

    public GoogleAuthorizationCodeFlow.Builder setRefreshListeners(Collection<CredentialRefreshListener> refreshListeners)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `refreshListeners` | `https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html<com.google.api.client.auth.oauth2.CredentialRefreshListener>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setRefreshListeners(java.util.Collection\<com.google.api.client.auth.oauth2.CredentialRefreshListener\>)

### setRequestInitializer(HttpRequestInitializer requestInitializer)

    public GoogleAuthorizationCodeFlow.Builder setRequestInitializer(HttpRequestInitializer requestInitializer)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `requestInitializer` | `com.google.api.client.http.HttpRequestInitializer` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setRequestInitializer(com.google.api.client.http.HttpRequestInitializer)

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

    public GoogleAuthorizationCodeFlow.Builder setScopes(Collection<String> scopes)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `scopes` | `https://docs.oracle.com/javase/8/docs/api/java/util/Collection.html<https://docs.oracle.com/javase/8/docs/api/java/lang/String.html>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setScopes(java.util.Collection\<java.lang.String\>)

### setTokenServerUrl(GenericUrl tokenServerUrl)

    public GoogleAuthorizationCodeFlow.Builder setTokenServerUrl(GenericUrl tokenServerUrl)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `tokenServerUrl` | `com.google.api.client.http.GenericUrl` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setTokenServerUrl(com.google.api.client.http.GenericUrl)

### setTransport(HttpTransport transport)

    public GoogleAuthorizationCodeFlow.Builder setTransport(HttpTransport transport)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `transport` | `com.google.api.client.http.HttpTransport` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow.Builder` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setTransport(com.google.api.client.http.HttpTransport)