# Google Auth Library Client - Class UserRefreshCredentials (1.50.1)

1.50.1 (latest) 1.50.0 1.49.0 1.48.1 1.47.1 1.46.0 1.45.2 Reference documentation and code samples for the Google Auth Library Client class UserRefreshCredentials.

Authenticates requests using User Refresh credentials.

This class allows authorizing requests from user refresh tokens.

This the end of the result of a 3LO flow. E.g, the end result of
'gcloud auth login' saves a file with these contents in well known
location

## Namespace

Google \\ Auth \\ Credentials

## Methods

### __construct

Create a new UserRefreshCredentials.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `scope` | `string|string[]|null` the scope of the access request, expressed either as an Array or as a space-delimited String. |
| `jsonKey` | `string|array` JSON credential file path or JSON credentials as an associative array |
| `targetAudience` | `string|null` The audience for the ID token. |

### fetchAuthToken

Fetches the auth tokens based on the current state.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `httpHandler` | `callable|null` |
| `headers` | `array` \[optional\] Metrics headers to be inserted into the token endpoint request present. This could be passed from ImersonatedServiceAccountCredentials as it uses UserRefreshCredentials as source credentials. |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `array` | { A set of auth related metadata, containing the following @type string $access_token @type int $expires_in @type string $scope @type string $token_type @type string $id_token } |

### getCacheKey

Return the Cache Key for the credentials.

The format for the Cache key is one of the following:
ClientId.Scope
ClientId.Audience

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### getLastReceivedToken

Returns an associative array with the token and
expiration time.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `array` |   |

### getQuotaProject

Get the quota project used for this API request

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string|null` |   |

### getGrantedScope

Get the granted scopes (if they exist) for the last fetched token.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string|null` |   |