# Class AuthorizationCodeResponseUrl (1.39.0)

<button class="button button-with-icon cloud-select-dropdown__button " aria-haspopup="true">Version latest</button>

- [1.39.0 (latest)](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl)
- [1.38.2](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.38.2/com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl)
- [1.37.0](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.37.0/com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl)
- [1.36.0](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.36.0/com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl)
- [1.34.1](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.34.1/com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl)
- [1.33.3](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.33.3/com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl)
- [1.32.1](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.32.1/com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl)

    public class AuthorizationCodeResponseUrl extends GenericUrl

OAuth 2.0 URL parser for the redirect URL after end user grants or denies authorization as
specified in [Authorization
Response](http://tools.ietf.org/html/rfc6749#section-4.1.2).

Check if [#getError()](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth2.AuthorizationCodeResponseUrl#com_google_api_client_auth_oauth2_AuthorizationCodeResponseUrl_getError__) is `null` to check if the end-user granted authorization.

Sample usage:


     public void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException {
     StringBuffer fullUrlBuf = request.getRequestURL();
     if (request.getQueryString() != null) {
     fullUrlBuf.append('?').append(request.getQueryString());
     }
     AuthorizationCodeResponseUrl authResponse =
     new AuthorizationCodeResponseUrl(fullUrlBuf.toString());
     // check for user-denied error
     if (authResponse.getError() != null) {
     // authorization denied...
     } else {
     // request access token using authResponse.getCode()...
     }
     }
     
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 \> AuthorizationCodeResponseUrl

## Inherited Members

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.clone() 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.set(java.lang.String,java.lang.Object) 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

### AuthorizationCodeResponseUrl(String encodedResponseUrl)

    public AuthorizationCodeResponseUrl(String encodedResponseUrl)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `encodedResponseUrl` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` encoded authorization code response URL |

## Methods

### clone()

    public AuthorizationCodeResponseUrl clone()

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

**Overrides** com.google.api.client.http.GenericUrl.clone()

### getCode()

    public final String getCode()

Returns the authorization code generated by the authorization server or `null` for none.

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

### getError()

    public final String getError()

Returns the error code (`"invalid_request"`, `"unauthorized_client"`, `
"access_denied"`, `"unsupported_response_type"`, `"invalid_scope"`, `
"server_error"`, `"temporarily_unavailable"`, or an extension error code as specified in
[Defining Additional Error Codes](http://tools.ietf.org/html/rfc6749#section-8.5))
or `null` for none.

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

### getErrorDescription()

    public final String getErrorDescription()

Returns the human-readable text providing additional information used to assist the client
developer in understanding the error that occurred or `null` for none.

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

### getErrorUri()

    public final String getErrorUri()

Returns the URI identifying a human-readable web page with information about the error used to
provide the client developer with additional information about the error or `null` for
none.

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

### getState()

    public final String getState()

Returns the state parameter matching the state parameter in the authorization request or `
null` for none.

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

### set(String fieldName, Object value)

    public AuthorizationCodeResponseUrl set(String fieldName, Object value)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `fieldName` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `value` | `https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html` |

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

**Overrides** com.google.api.client.http.GenericUrl.set(java.lang.String,java.lang.Object)

### setCode(String code)

    public AuthorizationCodeResponseUrl setCode(String code)

Sets the authorization code generated by the authorization server 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** ||
|---|---|
| **Name** | **Description** |
| `code` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

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

### setError(String error)

    public AuthorizationCodeResponseUrl setError(String error)

Sets the error code (`"invalid_request"`, `"unauthorized_client"`, `
"access_denied"`, `"unsupported_response_type"`, `"invalid_scope"`, `
"server_error"`, `"temporarily_unavailable"`, or an extension error code as specified in
[Defining Additional Error Codes](http://tools.ietf.org/html/rfc6749#section-8.5))
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** ||
|---|---|
| **Name** | **Description** |
| `error` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

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

### setErrorDescription(String errorDescription)

    public AuthorizationCodeResponseUrl setErrorDescription(String errorDescription)

Sets the human-readable text providing additional information used to assist the client
developer in understanding the error that occurred 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** ||
|---|---|
| **Name** | **Description** |
| `errorDescription` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

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

### setErrorUri(String errorUri)

    public AuthorizationCodeResponseUrl setErrorUri(String errorUri)

Sets the URI identifying a human-readable web page with information about the error used to
provide the client developer with additional information about the error 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** ||
|---|---|
| **Name** | **Description** |
| `errorUri` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

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

### setState(String state)

    public AuthorizationCodeResponseUrl setState(String state)

Sets the state parameter matching the state parameter in the authorization request 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** ||
|---|---|
| **Name** | **Description** |
| `state` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |

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