# Google Auth Library Client - Class ServiceAccountJwtAccessCredentials (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 ServiceAccountJwtAccessCredentials.

Authenticates requests using Google's Service Account credentials via
JWT Access.

This class allows authorizing requests for service accounts directly
from credentials from a json key file downloaded from the developer
console (via 'Generate new Json Key'). It is not part of any OAuth2
flow, rather it creates a JWT and sends that as a credential.

## Namespace

Google \\ Auth \\ Credentials

## Methods

### __construct

Create a new ServiceAccountJwtAccessCredentials.

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

### updateMetadata

Updates metadata with the authorization token.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `metadata` | `array` metadata hashmap |
| `authUri` | `string` optional auth uri |
| `httpHandler` | `callable|null` callback which delivers psr7 request |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `array` | updated metadata hashmap |

### fetchAuthToken

Implements FetchAuthTokenInterface#fetchAuthToken.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `httpHandler` | `callable|null` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `null|array{access_token: string}` | A set of auth related metadata |

### getCacheKey

Return the cache key for the credentials.

The format for the Cache Key one of the following:
ClientEmail.Scope
ClientEmail.Audience

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

### getLastReceivedToken

Returns an associative array with the token and
expiration time.

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

### getProjectId

Get the project ID from the service account keyfile.

Returns null if the project ID does not exist in the keyfile.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `httpHandler` | `callable|null` Not used by this credentials type. |

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

### getClientName

Get the client name from the keyfile.

In this case, it returns the keyfile's client_email key.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `httpHandler` | `callable|null` Not used by this credentials type. |

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

### getPrivateKey

Get the private key from the keyfile.

In this case, it returns the keyfile's private_key key, needed for JWT signing.

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

### getQuotaProject

Get the quota project used for this API request

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