google-cloud-0.0.4: Client for the Google Cloud APIs

Safe HaskellNone
LanguageHaskell2010

Google.Cloud.Internal.Token

Synopsis

Documentation

defaultMetadataToken :: Cloud Token Source

Fetch the access token for the default service account from the local metadata server. This only works when the code is running in the Google cloud and the instance has a services account attached to it.

cacheToken :: Token -> Cloud Token Source

Store the token in the cache. If the cache already contains a token, the better one of the two is actually stored (where *better* is defined as the one which expires later). So it is safe to call this function even if you are unsure if the token you have is better than the one which is already in the cache.

Returns the better token.

accessToken :: Cloud Text Source

Return the value of the access token. The function guarantees that the token is valid for at least 60 seconds. Though you should not be afraid to call the function frequently, it caches the token inside the Handle so there is very little overhead.

authorizationHeader :: Cloud Header Source

Construct a Header that contains the authorization details. Such a header needs to be supplied to all requsts which require authorization.

Not all requests require it. In particular, requests to the metadata server don't.