Class GoogleAuthorizationCodeFlow.Builder (2.0.0)

public static class GoogleAuthorizationCodeFlow.Builder extends AuthorizationCodeFlow.Builder

Google authorization code flow builder.

Implementation is not thread-safe.

Inheritance

java.lang.Object > com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder > GoogleAuthorizationCodeFlow.Builder

Constructors

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

public Builder(HttpTransport transport, JsonFactory jsonFactory, GoogleClientSecrets clientSecrets, Collection<String> scopes)
Parameters
NameDescription
transportcom.google.api.client.http.HttpTransport

HTTP transport

jsonFactorycom.google.api.client.json.JsonFactory

JSON factory

clientSecretsGoogleClientSecrets

Google client secrets

scopesCollection<String>

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
NameDescription
transportcom.google.api.client.http.HttpTransport

HTTP transport

jsonFactorycom.google.api.client.json.JsonFactory

JSON factory

clientIdString

client identifier

clientSecretString

client secret

scopesCollection<String>

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
NameDescription
refreshListenercom.google.api.client.auth.oauth2.CredentialRefreshListener
Returns
TypeDescription
GoogleAuthorizationCodeFlow.Builder
Overrides
com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.addRefreshListener(com.google.api.client.auth.oauth2.CredentialRefreshListener)

build()

public GoogleAuthorizationCodeFlow build()
Returns
TypeDescription
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
TypeDescription
String

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
TypeDescription
String

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
NameDescription
accessTypeString
Returns
TypeDescription
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
NameDescription
approvalPromptString
Returns
TypeDescription
GoogleAuthorizationCodeFlow.Builder

setAuthorizationServerEncodedUrl(String authorizationServerEncodedUrl)

public GoogleAuthorizationCodeFlow.Builder setAuthorizationServerEncodedUrl(String authorizationServerEncodedUrl)
Parameter
NameDescription
authorizationServerEncodedUrlString
Returns
TypeDescription
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
NameDescription
clientAuthenticationcom.google.api.client.http.HttpExecuteInterceptor
Returns
TypeDescription
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
NameDescription
clientIdString
Returns
TypeDescription
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
NameDescription
clockcom.google.api.client.util.Clock
Returns
TypeDescription
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
NameDescription
credentialCreatedListenercom.google.api.client.auth.oauth2.AuthorizationCodeFlow.CredentialCreatedListener
Returns
TypeDescription
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
NameDescription
typedDataStorecom.google.api.client.util.store.DataStore<com.google.api.client.auth.oauth2.StoredCredential>
Returns
TypeDescription
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
NameDescription
credentialStorecom.google.api.client.auth.oauth2.CredentialStore
Returns
TypeDescription
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
NameDescription
dataStorecom.google.api.client.util.store.DataStoreFactory
Returns
TypeDescription
GoogleAuthorizationCodeFlow.Builder
Overrides
com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setDataStoreFactory(com.google.api.client.util.store.DataStoreFactory)
Exceptions
TypeDescription
IOException

setJsonFactory(JsonFactory jsonFactory)

public GoogleAuthorizationCodeFlow.Builder setJsonFactory(JsonFactory jsonFactory)
Parameter
NameDescription
jsonFactorycom.google.api.client.json.JsonFactory
Returns
TypeDescription
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
NameDescription
methodcom.google.api.client.auth.oauth2.Credential.AccessMethod
Returns
TypeDescription
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
NameDescription
refreshListenersCollection<com.google.api.client.auth.oauth2.CredentialRefreshListener>
Returns
TypeDescription
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
NameDescription
requestInitializercom.google.api.client.http.HttpRequestInitializer
Returns
TypeDescription
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
NameDescription
scopesCollection<String>
Returns
TypeDescription
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
NameDescription
tokenServerUrlcom.google.api.client.http.GenericUrl
Returns
TypeDescription
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
NameDescription
transportcom.google.api.client.http.HttpTransport
Returns
TypeDescription
GoogleAuthorizationCodeFlow.Builder
Overrides
com.google.api.client.auth.oauth2.AuthorizationCodeFlow.Builder.setTransport(com.google.api.client.http.HttpTransport)