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

    public final class OAuthHmacCredential implements Credential, InstanceCallbacks

Beta   

OAuth 1 credential which uses the [OAuthHmacSigner](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.auth.oauth.OAuthHmacSigner) to sign requests.

This class is both immutable and thread safe.

## Inheritance

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

## Implements

[Credential](https://docs.cloud.google.com/java/docs/reference/google-oauth-client/latest/com.google.api.client.extensions.auth.helpers.Credential), [InstanceCallbacks](https://docs.oracle.com/javase/8/docs/api/javax/jdo/InstanceCallbacks.html)

## 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-)

## Constructors

### OAuthHmacCredential(String userId, String consumerKey, String sharedSecret, String tokenSharedSecret, String token)

    public OAuthHmacCredential(String userId, String consumerKey, String sharedSecret, String tokenSharedSecret, String token)

Create an OAuth 1 credential object from information obtained from the server.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `userId` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` User ID key that can be used to associate this credential with a user. |
| `consumerKey` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Key that identifies the server to the service provider. |
| `sharedSecret` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Secret that the server shares with the service provider. |
| `tokenSharedSecret` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Token secret that server uses to authenticate the requests. |
| `token` | `https://docs.oracle.com/javase/8/docs/api/java/lang/String.html` Token that has been authorized by the end user to allow the server to access the resources or `null` for none |

## Methods

### handleResponse(HttpRequest request, HttpResponse response, boolean retrySupported)

    public boolean handleResponse(HttpRequest request, HttpResponse response, boolean retrySupported)

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `request` | `com.google.api.client.http.HttpRequest` |
| `response` | `com.google.api.client.http.HttpResponse` |
| `retrySupported` | `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.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` |   |

### isInvalid()

    public boolean isInvalid()

Determine if the Credential is no longer valid, after being revoked for example.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.oracle.com/javase/tutorial/java/nutsandbolts/datatypes.html` |   |

### jdoPostLoad()

    public void jdoPostLoad()

### jdoPreClear()

    public void jdoPreClear()

### jdoPreDelete()

    public void jdoPreDelete()

### jdoPreStore()

    public void jdoPreStore()