Railsr.Auth (Railsr v1.0.0)

Copy Markdown View Source

OAuth 2.0 client-credentials token management for Railsr.

Tokens are automatically cached by Railsr.Auth.TokenCache and refreshed transparently 60 seconds before expiry. You should never need to call this module directly — Railsr.HTTP handles auth automatically.

Token Scopes

Railsr issues scoped tokens. Common scopes:

ScopePurpose
urn:railsr:endusersCreate / update endusers
urn:railsr:endusers.readonlyRead endusers
urn:railsr:ledgersCreate / update ledgers
urn:railsr:transactionsInitiate transactions
urn:railsr:beneficiariesManage beneficiaries
urn:railsr:cardsManage cards
urn:railsr:debitMandates & payments
urn:railsr:firewallCompliance firewall rules
urn:railsr:notificationsWebhook config
urn:railsr:quarantineResolve quarantine

Summary

Functions

Returns the list of all available OAuth scopes.

Fetch a fresh OAuth 2.0 bearer token from Railsr.

Functions

all_scopes()

@spec all_scopes() :: [String.t()]

Returns the list of all available OAuth scopes.

fetch_token(opts \\ [])

@spec fetch_token(keyword()) ::
  {:ok, Railsr.Types.Token.t()} | {:error, Railsr.Error.t()}

Fetch a fresh OAuth 2.0 bearer token from Railsr.

Normally called only by Railsr.Auth.TokenCache. Prefer Railsr.Auth.TokenCache.get_token/0 which returns a cached, auto-refreshed token.