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 GoogleAuthorizationCodeRequestUrl extends AuthorizationCodeRequestUrl
```
Google-specific implementation of the OAuth 2.0 URL builder for an authorization web page to
allow the end user to authorize the application to access their protected resources and that
returns an authorization code, as specified in [Using OAuth 2.0 for Web Server
Applications](https://developers.google.com/accounts/docs/OAuth2WebServer).

The default for #getResponseTypes() is `"code"`. Use AuthorizationCodeResponseUrl to parse the redirect response after the end user grants/denies the
request. Using the authorization code in this response, use [GoogleAuthorizationCodeTokenRequest](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeTokenRequest.md.txt) to request the access token.

Sample usage for a web application:

```java

 public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
      String url = new GoogleAuthorizationCodeRequestUrl(
           "812741506391.apps.googleusercontent.com",
           "https://oauth2-login-demo.appspot.com/code",
           Arrays.asList("https://www.googleapis.com/auth/userinfo.email",
                   "https://www.googleapis.com/auth/userinfo.profile"))
           .setState("/profile").build();
      response.sendRedirect(url);
 }
 
```

Implementation is not thread-safe.

## Inheritance

[Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> java.util.AbstractMap \> com.google.api.client.util.GenericData \> com.google.api.client.http.GenericUrl \> com.google.api.client.auth.oauth2.AuthorizationRequestUrl \> com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl \> GoogleAuthorizationCodeRequestUrl

## Inherited Members

com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.clone() com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.getCodeChallenge() com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.getCodeChallengeMethod() com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.set(java.lang.String,java.lang.Object) com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.setClientId(java.lang.String) com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.setCodeChallenge(java.lang.String) com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.setCodeChallengeMethod(java.lang.String) com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.setRedirectUri(java.lang.String) com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.setResponseTypes(java.util.Collection\<java.lang.String\>) com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.setScopes(java.util.Collection\<java.lang.String\>) com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.setState(java.lang.String) com.google.api.client.auth.oauth2.AuthorizationRequestUrl.getClientId() com.google.api.client.auth.oauth2.AuthorizationRequestUrl.getRedirectUri() com.google.api.client.auth.oauth2.AuthorizationRequestUrl.getResponseTypes() com.google.api.client.auth.oauth2.AuthorizationRequestUrl.getScopes() com.google.api.client.auth.oauth2.AuthorizationRequestUrl.getState() com.google.api.client.http.GenericUrl.appendRawPath(java.lang.String) com.google.api.client.http.GenericUrl.build() com.google.api.client.http.GenericUrl.buildAuthority() com.google.api.client.http.GenericUrl.buildRelativeUrl() com.google.api.client.http.GenericUrl.equals(java.lang.Object) com.google.api.client.http.GenericUrl.getAll(java.lang.String) com.google.api.client.http.GenericUrl.getFirst(java.lang.String) com.google.api.client.http.GenericUrl.getFragment() com.google.api.client.http.GenericUrl.getHost() com.google.api.client.http.GenericUrl.getPathParts() com.google.api.client.http.GenericUrl.getPort() com.google.api.client.http.GenericUrl.getRawPath() com.google.api.client.http.GenericUrl.getScheme() com.google.api.client.http.GenericUrl.getUserInfo() com.google.api.client.http.GenericUrl.hashCode() com.google.api.client.http.GenericUrl.setFragment(java.lang.String) com.google.api.client.http.GenericUrl.setHost(java.lang.String) com.google.api.client.http.GenericUrl.setPathParts(java.util.List\<java.lang.String\>) com.google.api.client.http.GenericUrl.setPort(int) com.google.api.client.http.GenericUrl.setRawPath(java.lang.String) com.google.api.client.http.GenericUrl.setScheme(java.lang.String) com.google.api.client.http.GenericUrl.setUserInfo(java.lang.String) com.google.api.client.http.GenericUrl.toPathParts(java.lang.String) com.google.api.client.http.GenericUrl.toPathParts(java.lang.String,boolean) com.google.api.client.http.GenericUrl.toString() com.google.api.client.http.GenericUrl.toURI() com.google.api.client.http.GenericUrl.toURL() com.google.api.client.http.GenericUrl.toURL(java.lang.String) com.google.api.client.util.GenericData.entrySet() com.google.api.client.util.GenericData.get(java.lang.Object) com.google.api.client.util.GenericData.getClassInfo() com.google.api.client.util.GenericData.getUnknownKeys() com.google.api.client.util.GenericData.put(java.lang.String,java.lang.Object) com.google.api.client.util.GenericData.putAll(java.util.Map\<? extends java.lang.String,?\>) com.google.api.client.util.GenericData.remove(java.lang.Object) com.google.api.client.util.GenericData.setUnknownKeys(java.util.Map\<java.lang.String,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.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.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-) [AbstractMap.clear()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#clear--) [AbstractMap.containsKey(Object)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#containsKey-java.lang.Object-) [AbstractMap.containsValue(Object)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#containsValue-java.lang.Object-) [AbstractMap.isEmpty()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#isEmpty--) [AbstractMap.keySet()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#keySet--) [AbstractMap.put(K,V)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#put-K-V-) [AbstractMap.putAll(Map\<? extends K,? extends V\>)](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#putAll-java.util.Map<? extends K-? extends V>-) [AbstractMap.size()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#size--) [AbstractMap.values()](https://docs.oracle.com/javase/8/docs/api/java/util/AbstractMap.html#values--)

## Constructors

### GoogleAuthorizationCodeRequestUrl(GoogleClientSecrets clientSecrets, String redirectUri, Collection\<String\> scopes)

```java
public GoogleAuthorizationCodeRequestUrl(GoogleClientSecrets clientSecrets, String redirectUri, Collection<String> scopes)
```

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `clientSecrets` | `GoogleClientSecrets` OAuth 2.0 client secrets JSON model as specified in [client_secrets.json file format](https://developers.google.com/api-client-library/python/guide/aaa_client_secrets) |
| `redirectUri` | `String` URI that the authorization server directs the resource owner's user-agent back to the client after a successful authorization grant |
| `scopes` | `Collection<String>` scopes (see [#setScopes(Collection)](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl.md.txt#com_google_api_client_googleapis_auth_oauth2_GoogleAuthorizationCodeRequestUrl_setScopes_java_util_Collection_java_lang_String__)) |

### GoogleAuthorizationCodeRequestUrl(String authorizationServerEncodedUrl, String clientId, String redirectUri, Collection\<String\> scopes)

```java
public GoogleAuthorizationCodeRequestUrl(String authorizationServerEncodedUrl, String clientId, String redirectUri, Collection<String> scopes)
```

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `authorizationServerEncodedUrl` | `String` authorization server encoded URL |
| `clientId` | `String` client identifier |
| `redirectUri` | `String` URI that the authorization server directs the resource owner's user-agent back to the client after a successful authorization grant |
| `scopes` | `Collection<String>` scopes (see [#setScopes(Collection)](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl.md.txt#com_google_api_client_googleapis_auth_oauth2_GoogleAuthorizationCodeRequestUrl_setScopes_java_util_Collection_java_lang_String__)) |

### GoogleAuthorizationCodeRequestUrl(String clientId, String redirectUri, Collection\<String\> scopes)

```java
public GoogleAuthorizationCodeRequestUrl(String clientId, String redirectUri, Collection<String> scopes)
```

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `clientId` | `String` client identifier |
| `redirectUri` | `String` URI that the authorization server directs the resource owner's user-agent back to the client after a successful authorization grant |
| `scopes` | `Collection<String>` scopes (see [#setScopes(Collection)](https://docs.cloud.google.com/java/docs/reference/google-api-client/latest/com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl.md.txt#com_google_api_client_googleapis_auth_oauth2_GoogleAuthorizationCodeRequestUrl_setScopes_java_util_Collection_java_lang_String__)) |

## Methods

### clone()

```java
public GoogleAuthorizationCodeRequestUrl clone()
```

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GoogleAuthorizationCodeRequestUrl` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.clone()

### getAccessType()

```java
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()

```java
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` |   |

### set(String fieldName, Object value)

```java
public GoogleAuthorizationCodeRequestUrl set(String fieldName, Object value)
```

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldName` | `String` |
| `value` | `Object` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GoogleAuthorizationCodeRequestUrl` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.set(java.lang.String,java.lang.Object)

### setAccessType(String accessType)

```java
public GoogleAuthorizationCodeRequestUrl setAccessType(String accessType)
```
Sets the access type (`"online"` to request online access or `"offline"` to request
offline access) or `null` for the default behavior of `"online"`.

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `accessType` | `String` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GoogleAuthorizationCodeRequestUrl` |   |

### setApprovalPrompt(String approvalPrompt)

```java
public GoogleAuthorizationCodeRequestUrl 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 of `"auto"`.

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

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `approvalPrompt` | `String` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GoogleAuthorizationCodeRequestUrl` |   |

### setClientId(String clientId)

```java
public GoogleAuthorizationCodeRequestUrl setClientId(String clientId)
```

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `clientId` | `String` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GoogleAuthorizationCodeRequestUrl` |   |

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

### setRedirectUri(String redirectUri)

```java
public GoogleAuthorizationCodeRequestUrl setRedirectUri(String redirectUri)
```

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `redirectUri` | `String` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GoogleAuthorizationCodeRequestUrl` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.setRedirectUri(java.lang.String)

### setResponseTypes(Collection\<String\> responseTypes)

```java
public GoogleAuthorizationCodeRequestUrl setResponseTypes(Collection<String> responseTypes)
```

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `responseTypes` | `Collection<String>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GoogleAuthorizationCodeRequestUrl` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.setResponseTypes(java.util.Collection\<java.lang.String\>)

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

```java
public GoogleAuthorizationCodeRequestUrl setScopes(Collection<String> scopes)
```

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

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GoogleAuthorizationCodeRequestUrl` |   |

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

### setState(String state)

```java
public GoogleAuthorizationCodeRequestUrl setState(String state)
```

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `state` | `String` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `GoogleAuthorizationCodeRequestUrl` |   |

**Overrides** com.google.api.client.auth.oauth2.AuthorizationCodeRequestUrl.setState(java.lang.String)