public class GoogleAuthorizationCodeFlow extends AuthorizationCodeFlowThread-safe Google OAuth 2.0 authorization code flow that manages and persists end-user credentials.
This is designed to simplify the flow in which an end-user authorizes the application to access their protected data, and then the application has access to their data based on an access token and a refresh token to refresh that access token when it expires.
The first step is to call #loadCredential(String) based on the known user ID to check
 if the end-user's credentials are already known. If not, call #newAuthorizationUrl() and
 direct the end-user's browser to an authorization page. The web browser will then redirect to the
 redirect URL with a "code" query parameter which can then be used to request an access
 token using #newTokenRequest(String). Finally, use #createAndStoreCredential(TokenResponse, String) to store and obtain a credential for accessing
 protected resources.
The default for the approval_prompt and access_type parameters is 
 null. For web applications that means "approval_prompt=auto&access_type=online" and for
 installed applications that means "approval_prompt=force&access_type=offline". To
 override the default, you need to explicitly call Builder#setApprovalPrompt(String) and
 Builder#setAccessType(String).
Inheritance
java.lang.Object > com.google.api.client.auth.oauth2.AuthorizationCodeFlow > GoogleAuthorizationCodeFlowConstructors
GoogleAuthorizationCodeFlow(GoogleAuthorizationCodeFlow.Builder builder)
protected GoogleAuthorizationCodeFlow(GoogleAuthorizationCodeFlow.Builder builder)| Parameter | |
|---|---|
| Name | Description | 
builder | 
        GoogleAuthorizationCodeFlow.BuilderGoogle authorization code flow builder  | 
      
GoogleAuthorizationCodeFlow(HttpTransport transport, JsonFactory jsonFactory, String clientId, String clientSecret, Collection<String> scopes)
public GoogleAuthorizationCodeFlow(HttpTransport transport, JsonFactory jsonFactory, String clientId, String clientSecret, Collection<String> scopes)| Parameters | |
|---|---|
| Name | Description | 
transport | 
        com.google.api.client.http.HttpTransportHTTP transport  | 
      
jsonFactory | 
        com.google.api.client.json.JsonFactoryJSON factory  | 
      
clientId | 
        Stringclient identifier  | 
      
clientSecret | 
        Stringclient secret  | 
      
scopes | 
        Collection<String>collection of scopes to be joined by a space separator  | 
      
Methods
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 | 
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 | |
|---|---|
| Type | Description | 
String | 
        |
newAuthorizationUrl()
public GoogleAuthorizationCodeRequestUrl newAuthorizationUrl()| Returns | |
|---|---|
| Type | Description | 
GoogleAuthorizationCodeRequestUrl | 
        |
newTokenRequest(String authorizationCode)
public GoogleAuthorizationCodeTokenRequest newTokenRequest(String authorizationCode)| Parameter | |
|---|---|
| Name | Description | 
authorizationCode | 
        String | 
      
| Returns | |
|---|---|
| Type | Description | 
GoogleAuthorizationCodeTokenRequest | 
        |