# Class OAuthParameters (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.oauth.OAuthParameters)
- [1.38.2](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.38.2/com.google.api.client.auth.oauth.OAuthParameters)
- [1.37.0](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.37.0/com.google.api.client.auth.oauth.OAuthParameters)
- [1.36.0](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.36.0/com.google.api.client.auth.oauth.OAuthParameters)
- [1.34.1](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.34.1/com.google.api.client.auth.oauth.OAuthParameters)
- [1.33.3](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.33.3/com.google.api.client.auth.oauth.OAuthParameters)
- [1.32.1](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/1.32.1/com.google.api.client.auth.oauth.OAuthParameters)

    public final class OAuthParameters implements HttpExecuteInterceptor, HttpRequestInitializer

Beta   

OAuth 1.0a parameter manager.

The only required non-computed fields are [#signer](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth.OAuthParameters#com_google_api_client_auth_oauth_OAuthParameters_signer) and [#consumerKey](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth.OAuthParameters#com_google_api_client_auth_oauth_OAuthParameters_consumerKey). Use [#token](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth.OAuthParameters#com_google_api_client_auth_oauth_OAuthParameters_token) to specify token or temporary credentials.

Sample usage, taking advantage that this class implements HttpRequestInitializer:


     public static HttpRequestFactory createRequestFactory(HttpTransport transport) {
     OAuthParameters parameters = new OAuthParameters();
     // ...
     return transport.createRequestFactory(parameters);
     }
     
If you have a custom request initializer, take a look at the sample usage for HttpExecuteInterceptor, which this class also implements.

## Inheritance

[java.lang.Object](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html) \> OAuthParameters

## Implements

com.google.api.client.http.HttpExecuteInterceptor, com.google.api.client.http.HttpRequestInitializer

## Inherited Members

[Object.clone()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#clone--) [Object.equals(Object)](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#equals-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.hashCode()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#hashCode--) [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.toString()](https://docs.oracle.com/javase/8/docs/api/java/lang/Object.html#toString--) [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-)

## Static Methods

### escape(String value)

    public static String escape(String value)

Returns the escaped form of the given value using OAuth escaping rules.

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

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

## Constructors

### OAuthParameters()

    public OAuthParameters()

## Fields

### callback

    public String callback

Absolute URI back to which the server will redirect the resource owner when the Resource Owner
Authorization step is completed.

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

### consumerKey

    public String consumerKey

Required identifier portion of the client credentials (equivalent to a username).

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

### nonce

    public String nonce

Required nonce value. Should be computed using [#computeNonce()](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth.OAuthParameters#com_google_api_client_auth_oauth_OAuthParameters_computeNonce__).

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

### realm

    public String realm

Realm.

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

### signature

    public String signature

Signature. Required but normally computed using [#computeSignature](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth.OAuthParameters#com_google_api_client_auth_oauth_OAuthParameters_computeSignature_).

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

### signatureMethod

    public String signatureMethod

Name of the signature method used by the client to sign the request. Required, but normally
computed using [#computeSignature](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth.OAuthParameters#com_google_api_client_auth_oauth_OAuthParameters_computeSignature_).

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

### signer

    public OAuthSigner signer

Required OAuth signature algorithm.

| **Field Value** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth.OAuthSigner` |   |

### timestamp

    public String timestamp

Required timestamp value. Should be computed using [#computeTimestamp()](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth.OAuthParameters#com_google_api_client_auth_oauth_OAuthParameters_computeTimestamp__).

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

### token

    public String token

Token value used to associate the request with the resource owner or `null` if the
request is not associated with a resource owner.

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

### verifier

    public String verifier

The verification code received from the server.

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

### version

    public String version

Must either be "1.0" or `null` to skip. Provides the version of the authentication
process as defined in this specification.

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

## Methods

### computeNonce()

    public void computeNonce()

Computes a nonce based on the hex string of a random non-negative long, setting the value of
the [#nonce](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth.OAuthParameters#com_google_api_client_auth_oauth_OAuthParameters_nonce) field.

### computeSignature(String requestMethod, GenericUrl requestUrl)

    public void computeSignature(String requestMethod, GenericUrl requestUrl)

Computes a new signature based on the fields and the given request method and URL, setting the
values of the [#signature](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth.OAuthParameters#com_google_api_client_auth_oauth_OAuthParameters_signature) and [#signatureMethod](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth.OAuthParameters#com_google_api_client_auth_oauth_OAuthParameters_signatureMethod) fields.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `requestMethod` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` |
| `requestUrl` | `com.google.api.client.http.GenericUrl` |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/security/GeneralSecurityException.html` | general security exception |

### computeTimestamp()

    public void computeTimestamp()

Computes a timestamp based on the current system time, setting the value of the [#timestamp](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth.OAuthParameters#com_google_api_client_auth_oauth_OAuthParameters_timestamp) field.

### getAuthorizationHeader()

    public String getAuthorizationHeader()

Returns the `Authorization` header value to use with the OAuth parameter values found in
the fields.

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

### initialize(HttpRequest request)

    public void initialize(HttpRequest request)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `com.google.api.client.http.HttpRequest` |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |

### intercept(HttpRequest request)

    public void intercept(HttpRequest request)

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `request` | `com.google.api.client.http.HttpRequest` |

| **Exceptions** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/8/docs/api/java/io/IOException.html` |   |