Google Auth Library Client - Class FetchAuthTokenCache (1.45.2)

Reference documentation and code samples for the Google Auth Library Client class FetchAuthTokenCache.

A class to implement caching for any object implementing FetchAuthTokenInterface

Namespace

Google \ Auth

Methods

__construct

Parameters
Name Description
fetcher FetchAuthTokenInterface

A credentials fetcher

cacheConfig array|null

Configuration for the cache

cache Psr\Cache\CacheItemPoolInterface

getFetcher

Returns
Type Description
FetchAuthTokenInterface

fetchAuthToken

Implements FetchAuthTokenInterface#fetchAuthToken.

Checks the cache for a valid auth token and fetches the auth tokens from the supplied fetcher.

Parameter
Name Description
httpHandler callable|null

callback which delivers psr7 request

Returns
Type Description
array the response

getCacheKey

Obtains a key that can used to cache the results of #fetchAuthToken.

Returns
Type Description
string

getLastReceivedToken

Returns an associative array with the token and expiration time.

Returns
Type Description
array|null

getClientName

Get the client name from the fetcher.

Parameter
Name Description
httpHandler callable|null

An HTTP handler to deliver PSR7 requests.

Returns
Type Description
string

signBlob

Sign a blob using the fetcher.

Parameters
Name Description
stringToSign string

The string to sign.

forceOpenSsl bool

Require use of OpenSSL for local signing. Does not apply to signing done using external services. Defaults to false.

Returns
Type Description
string The resulting signature.

getQuotaProject

Get the quota project used for this API request from the credentials fetcher.

Returns
Type Description
string|null

getProjectId

Get the Project ID from the fetcher.

Parameter
Name Description
httpHandler callable|null

Callback which delivers psr7 request

Returns
Type Description
string|null

getUniverseDomain

Get the universe domain from the credential. This should always return a string, and default to "googleapis.com" if no universe domain is configured.

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