PrimaAuth0Ex. TokenProvider
(prima_auth0_ex v0.11.0)
View Source
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
Functions
Returns a specification to start this module under a supervisor.
Types
@type t() :: %PrimaAuth0Ex.TokenProvider{ credentials: PrimaAuth0Ex.Auth0Credentials, refresh_times: %{required(String.t()) => DateTime.t()}, tokens: %{required(String.t()) => PrimaAuth0Ex.TokenProvider.TokenInfo.t()} }
Functions
Returns a specification to start this module under a supervisor.
See Supervisor.
@spec refresh_token_for(GenServer.server(), String.t()) :: {:ok, String.t()} | {:error, any()}
@spec token_for(GenServer.server(), String.t()) :: {:ok, String.t()} | {:error, any()}