View Source PrimaAuth0Ex.TokenProvider (prima_auth0_ex v0.3.1)

GenServer that handles the storage and refresh of tokens.

Every time a token for a new audience is requested, it retrieves it either from a cache (when possible) or from an authorization provider. Then, it runs periodic checks to ensure that all tokens are still valid, and it refreshes them when necessary.

Link to this section Summary

Link to this section Types

Specs

t() :: %PrimaAuth0Ex.TokenProvider{
  credentials: PrimaAuth0Ex.Auth0Credentials,
  refresh_times: %{required(String.t()) => Timex.Types.valid_datetime()},
  tokens: %{required(String.t()) => PrimaAuth0Ex.TokenProvider.TokenInfo.t()}
}

Link to this section Functions

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

refresh_token_for(pid, target_audience)

View Source

Specs

refresh_token_for(GenServer.server(), String.t()) ::
  {:ok, String.t()} | {:error, any()}
Link to this function

token_for(pid, target_audience)

View Source

Specs

token_for(GenServer.server(), String.t()) :: {:ok, String.t()} | {:error, any()}