A supervised GenServer holding the current access/refresh token pair
for one Monzo user, and performing the actual refresh call.
You normally don't interact with this module directly - Monzo.Client
starts and owns one automatically. It's exposed publicly for advanced
use cases: sharing a single token store across multiple clients, or
wiring it into your own supervision tree with a registered :name.
Summary
Functions
Returns the current access token, or nil.
Refreshes the access token using the stored refresh token and client
credentials. Returns {:error, :no_refresh_credentials} without making
any request if they aren't configured.
Manually sets new tokens (e.g. after completing the OAuth flow).
Starts a token store process directly (e.g. under your own supervision tree).
Starts a token store under Monzo.TokenStore.Supervisor, unlinked from the caller.
Types
Functions
@spec access_token(GenServer.server()) :: String.t() | nil
Returns the current access token, or nil.
@spec refresh(GenServer.server()) :: {:ok, String.t()} | {:error, term()}
Refreshes the access token using the stored refresh token and client
credentials. Returns {:error, :no_refresh_credentials} without making
any request if they aren't configured.
@spec set_tokens(GenServer.server(), String.t(), String.t() | nil) :: :ok
Manually sets new tokens (e.g. after completing the OAuth flow).
@spec start_link(keyword()) :: GenServer.on_start()
Starts a token store process directly (e.g. under your own supervision tree).
@spec start_supervised(keyword()) :: DynamicSupervisor.on_start_child()
Starts a token store under Monzo.TokenStore.Supervisor, unlinked from the caller.