goth v1.2.0 Goth.Client

Goth.Client is the module through which all interaction with Google's APIs flows. For the most part, you probably don't want to use this module directly, but instead use the other modules that cache and wrap the underlying API calls.

Available Options

The first parameter is either the token scopes or a tuple of the service account client email and its scopes.

Additional token attributes are controlled through options. Available values:

  • iat - The time the assertion was issued, default to now.
  • sub - The email address of the user for which the application is requesting delegated access. Default values is taken from the config :actor_email.

See Google's Documentation for more details.

Link to this section Summary

Functions

Note: Most often, you'll want to use Goth.Token.for_scope/1 instead of this method. As the docs for Goth.Token.for_scope/1 note, it will return a cached token if one already exists, thus saving you the cost of a round-trip to the server to generate a new token

Retrieves the project ID from Google's metadata service

Link to this section Functions

Link to this function

claims(scope, opts \\ [])

Link to this function

get_access_token(scope)

Note: Most often, you'll want to use Goth.Token.for_scope/1 instead of this method. As the docs for Goth.Token.for_scope/1 note, it will return a cached token if one already exists, thus saving you the cost of a round-trip to the server to generate a new token.

Goth.Client.get_access_token/1, on the other hand will always hit the server to retrieve a new token.

Link to this function

get_access_token(scope, opts)

Link to this function

json(scope, opts \\ [])

Link to this function

jwt(info, opts \\ [])

Link to this function

retrieve_metadata_project()

Retrieves the project ID from Google's metadata service