View Source PrimaAuth0Ex.TokenProvider (prima_auth0_ex v0.3.0)
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
Functions
Returns a specification to start this module under a supervisor.
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
.
Specs
refresh_token_for(GenServer.server(), String.t()) :: {:ok, String.t()} | {:error, any()}
Specs
token_for(GenServer.server(), String.t()) :: {:ok, String.t()} | {:error, any()}