ExStoneOpenbank v0.1.0 ExStoneOpenbank.Authenticator View Source

Responsible for authentication of the service application.

Authentication is done through issuing a JWT to the token endpoint according to client_credentials flow. The JWT is signed using the private key in the given configuration.

The result is an access_token and a refresh_token. The access_token is used in all authenticated calls. The refresh token is used to get a new access_token without issuing a new token.

Link to this section Summary

Functions

Gets the access_token for the given configuration.

Authenticates with Stone Openbank API using the given signer and client_id

Returns a specification to start this module under a supervisor.

Refreshes the token synchronously

Link to this section Functions

Link to this function

access_token(name)

View Source
access_token(name :: atom()) :: {:ok, String.t()} | {:error, :unauthenticated}

Gets the access_token for the given configuration.

Link to this function

authenticate(name)

View Source
authenticate(name :: atom()) ::
  {:ok,
   %{access_token: token :: String.t(), refresh_token: token :: String.t()}}
  | {:error, reason :: atom()}

Authenticates with Stone Openbank API using the given signer and client_id

Returns a specification to start this module under a supervisor.

See Supervisor.

Link to this function

refresh_token(name)

View Source
refresh_token(name :: atom()) :: {:ok, String.t()}

Refreshes the token synchronously