Pristine.Adapters.TokenSource.Refreshable (Pristine v0.3.0)

Copy Markdown View Source

Token source wrapper that refreshes expiring OAuth2 tokens through Pristine.OAuth2.

Options:

  • :inner_source - required wrapped token source as {module, keyword()} or module
  • :provider - required Pristine.OAuth2.Provider
  • :context - Pristine context used for the refresh request
  • :client_id - OAuth client id for the refresh request
  • :client_secret - OAuth client secret for the refresh request
  • :token_params - extra provider-specific refresh params
  • :refresh_skew_seconds - refresh before expiry by this many seconds

The wrapper only attempts refresh when the current token has a real expires_at value. If the provider returns a replacement refresh token, the wrapper persists that rotated value back through the wrapped token source.