Class AuthorizationCodeFlow.Builder (1.32.1)

public static class AuthorizationCodeFlow.Builder

Authorization code flow builder.

Implementation is not thread-safe.

Inheritance

java.lang.Object > AuthorizationCodeFlow.Builder

Constructors

Builder(Credential.AccessMethod method, HttpTransport transport, JsonFactory jsonFactory, GenericUrl tokenServerUrl, HttpExecuteInterceptor clientAuthentication, String clientId, String authorizationServerEncodedUrl)

public Builder(Credential.AccessMethod method, HttpTransport transport, JsonFactory jsonFactory, GenericUrl tokenServerUrl, HttpExecuteInterceptor clientAuthentication, String clientId, String authorizationServerEncodedUrl)
Parameters
NameDescription
methodCredential.AccessMethod

method of presenting the access token to the resource server (for example BearerToken#authorizationHeaderAccessMethod)

transportcom.google.api.client.http.HttpTransport

HTTP transport

jsonFactorycom.google.api.client.json.JsonFactory

JSON factory

tokenServerUrlcom.google.api.client.http.GenericUrl

token server URL

clientAuthenticationcom.google.api.client.http.HttpExecuteInterceptor

client authentication or null for none (see TokenRequest#setClientAuthentication(HttpExecuteInterceptor))

clientIdString

client identifier

authorizationServerEncodedUrlString

authorization server encoded URL

Methods

addRefreshListener(CredentialRefreshListener refreshListener)

public AuthorizationCodeFlow.Builder addRefreshListener(CredentialRefreshListener refreshListener)

Adds a listener for refresh token results.

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

Parameter
NameDescription
refreshListenerCredentialRefreshListener

refresh listener

Returns
TypeDescription
AuthorizationCodeFlow.Builder

build()

public AuthorizationCodeFlow build()

Returns a new instance of an authorization code flow based on this builder.

Returns
TypeDescription
AuthorizationCodeFlow

enablePKCE()

public AuthorizationCodeFlow.Builder enablePKCE()

Enables Proof Key for Code Exchange (PKCE) for this Athorization Code Flow.

Returns
TypeDescription
AuthorizationCodeFlow.Builder

getAuthorizationServerEncodedUrl()

public final String getAuthorizationServerEncodedUrl()

Returns the authorization server encoded URL.

Returns
TypeDescription
String

getClientAuthentication()

public final HttpExecuteInterceptor getClientAuthentication()

Returns the client authentication or null for none (see TokenRequest#setClientAuthentication(HttpExecuteInterceptor)).

Returns
TypeDescription
com.google.api.client.http.HttpExecuteInterceptor

getClientId()

public final String getClientId()

Returns the client identifier.

Returns
TypeDescription
String

getClock()

public final Clock getClock()

Returns the clock passed along to the Credential or Clock#SYSTEM when system default is used.

Returns
TypeDescription
com.google.api.client.util.Clock

getCredentialCreatedListener()

public final AuthorizationCodeFlow.CredentialCreatedListener getCredentialCreatedListener()

Returns the credential created listener or null for none.

Returns
TypeDescription
AuthorizationCodeFlow.CredentialCreatedListener

getCredentialDataStore()

public final DataStore<StoredCredential> getCredentialDataStore()

Beta
Returns the stored credential data store or null for none.

Returns
TypeDescription
com.google.api.client.util.store.DataStore<StoredCredential>

getCredentialStore() (deprecated)

public final CredentialStore getCredentialStore()

(deprecated) (to be removed in the future) Use #getCredentialDataStore() instead.

Beta
Returns the credential persistence store or null for none.

Returns
TypeDescription
CredentialStore

getJsonFactory()

public final JsonFactory getJsonFactory()

Returns the JSON factory.

Returns
TypeDescription
com.google.api.client.json.JsonFactory

getMethod()

public final Credential.AccessMethod getMethod()

Returns the method of presenting the access token to the resource server (for example BearerToken#authorizationHeaderAccessMethod).

Returns
TypeDescription
Credential.AccessMethod

getRefreshListeners()

public final Collection<CredentialRefreshListener> getRefreshListeners()

Returns the listeners for refresh token results.

Returns
TypeDescription
Collection<CredentialRefreshListener>

getRequestInitializer()

public final HttpRequestInitializer getRequestInitializer()

Returns the HTTP request initializer or null for none.

Returns
TypeDescription
com.google.api.client.http.HttpRequestInitializer

getScopes()

public final Collection<String> getScopes()

Returns a collection of scopes.

Returns
TypeDescription
Collection<String>

getTokenServerUrl()

public final GenericUrl getTokenServerUrl()

Returns the token server URL.

Returns
TypeDescription
com.google.api.client.http.GenericUrl

getTransport()

public final HttpTransport getTransport()

Returns the HTTP transport.

Returns
TypeDescription
com.google.api.client.http.HttpTransport

setAuthorizationServerEncodedUrl(String authorizationServerEncodedUrl)

public AuthorizationCodeFlow.Builder setAuthorizationServerEncodedUrl(String authorizationServerEncodedUrl)

Sets the authorization server encoded URL.

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

Parameter
NameDescription
authorizationServerEncodedUrlString
Returns
TypeDescription
AuthorizationCodeFlow.Builder

setClientAuthentication(HttpExecuteInterceptor clientAuthentication)

public AuthorizationCodeFlow.Builder setClientAuthentication(HttpExecuteInterceptor clientAuthentication)

Sets the client authentication or null for none (see TokenRequest#setClientAuthentication(HttpExecuteInterceptor)).

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

Parameter
NameDescription
clientAuthenticationcom.google.api.client.http.HttpExecuteInterceptor
Returns
TypeDescription
AuthorizationCodeFlow.Builder

setClientId(String clientId)

public AuthorizationCodeFlow.Builder setClientId(String clientId)

Sets the client identifier.

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

Parameter
NameDescription
clientIdString
Returns
TypeDescription
AuthorizationCodeFlow.Builder

setClock(Clock clock)

public AuthorizationCodeFlow.Builder setClock(Clock clock)

Sets the clock to pass to the Credential.

The default value for this parameter is Clock#SYSTEM

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

Parameter
NameDescription
clockcom.google.api.client.util.Clock
Returns
TypeDescription
AuthorizationCodeFlow.Builder

setCredentialCreatedListener(AuthorizationCodeFlow.CredentialCreatedListener credentialCreatedListener)

public AuthorizationCodeFlow.Builder setCredentialCreatedListener(AuthorizationCodeFlow.CredentialCreatedListener credentialCreatedListener)

Sets the credential created listener or null for none.

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

Parameter
NameDescription
credentialCreatedListenerAuthorizationCodeFlow.CredentialCreatedListener
Returns
TypeDescription
AuthorizationCodeFlow.Builder

setCredentialDataStore(DataStore<StoredCredential> credentialDataStore)

public AuthorizationCodeFlow.Builder setCredentialDataStore(DataStore<StoredCredential> credentialDataStore)

Beta
Sets the stored credential data store or null for none.

Warning: not compatible with #setCredentialStore, and if it is called before this method is called, this method will throw an IllegalArgumentException.

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

Parameter
NameDescription
credentialDataStorecom.google.api.client.util.store.DataStore<StoredCredential>
Returns
TypeDescription
AuthorizationCodeFlow.Builder

setCredentialStore(CredentialStore credentialStore) (deprecated)

public AuthorizationCodeFlow.Builder setCredentialStore(CredentialStore credentialStore)

(deprecated) (to be removed in the future) Use #setDataStoreFactory(DataStoreFactory) or #setCredentialDataStore(DataStore) instead.

Beta
Sets the credential persistence store or null for none.

Warning: not compatible with #setDataStoreFactory or #setCredentialDataStore, and if either of those is called before this method is called, this method will throw an IllegalArgumentException.

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

Parameter
NameDescription
credentialStoreCredentialStore
Returns
TypeDescription
AuthorizationCodeFlow.Builder

setDataStoreFactory(DataStoreFactory dataStoreFactory)

public AuthorizationCodeFlow.Builder setDataStoreFactory(DataStoreFactory dataStoreFactory)

Beta
Sets the data store factory or null for none.

Warning: not compatible with #setCredentialStore, and if it is called before this method is called, this method will throw an IllegalArgumentException.

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

Parameter
NameDescription
dataStoreFactorycom.google.api.client.util.store.DataStoreFactory
Returns
TypeDescription
AuthorizationCodeFlow.Builder
Exceptions
TypeDescription
IOException

setJsonFactory(JsonFactory jsonFactory)

public AuthorizationCodeFlow.Builder setJsonFactory(JsonFactory jsonFactory)

Sets the JSON factory.

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

Parameter
NameDescription
jsonFactorycom.google.api.client.json.JsonFactory
Returns
TypeDescription
AuthorizationCodeFlow.Builder

setMethod(Credential.AccessMethod method)

public AuthorizationCodeFlow.Builder setMethod(Credential.AccessMethod method)

Sets the method of presenting the access token to the resource server (for example BearerToken#authorizationHeaderAccessMethod).

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

Parameter
NameDescription
methodCredential.AccessMethod
Returns
TypeDescription
AuthorizationCodeFlow.Builder

setRefreshListeners(Collection<CredentialRefreshListener> refreshListeners)

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

Sets the listeners for refresh token results.

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

Parameter
NameDescription
refreshListenersCollection<CredentialRefreshListener>
Returns
TypeDescription
AuthorizationCodeFlow.Builder

setRequestInitializer(HttpRequestInitializer requestInitializer)

public AuthorizationCodeFlow.Builder setRequestInitializer(HttpRequestInitializer requestInitializer)

Sets the HTTP request initializer or null for none.

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

Parameter
NameDescription
requestInitializercom.google.api.client.http.HttpRequestInitializer
Returns
TypeDescription
AuthorizationCodeFlow.Builder

setScopes(Collection<String> scopes)

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

Sets the collection of scopes.

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

Parameter
NameDescription
scopesCollection<String>

collection of scopes

Returns
TypeDescription
AuthorizationCodeFlow.Builder

setTokenServerUrl(GenericUrl tokenServerUrl)

public AuthorizationCodeFlow.Builder setTokenServerUrl(GenericUrl tokenServerUrl)

Sets the token server URL.

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

Parameter
NameDescription
tokenServerUrlcom.google.api.client.http.GenericUrl
Returns
TypeDescription
AuthorizationCodeFlow.Builder

setTransport(HttpTransport transport)

public AuthorizationCodeFlow.Builder setTransport(HttpTransport transport)

Sets the HTTP transport.

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

Parameter
NameDescription
transportcom.google.api.client.http.HttpTransport
Returns
TypeDescription
AuthorizationCodeFlow.Builder