View Source PrimaAuth0Ex.TokenProvider (prima_auth0_ex v0.6.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.

Summary

Types

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

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
@spec refresh_token_for(GenServer.server(), String.t()) ::
  {:ok, String.t()} | {:error, any()}
Link to this function

token_for(pid, target_audience)

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