MoneyHub.AuthRequests (MoneyHub v1.0.0)

Copy Markdown View Source

The Auth Requests API: an alternative to building authorisation URLs and Pushed Authorisation Requests by hand (see MoneyHub.Auth) - you send the desired scope/claims to this endpoint with your client_credentials token, and Moneyhub returns a ready-to-use authorisation URL.

This trades a little flexibility (you can't customise every OIDC parameter) for convenience, and is useful when you'd rather not construct the PAR request body or sign request objects by hand.

See Auth Requests.

Summary

Functions

Creates an auth request, returning a map that includes a hosted authorisation "url" to redirect the user's browser to.

Fetches an auth request's current status by id.

Lists all auth requests created by this API client.

Updates an auth request. Requires both auth_requests:read and auth_requests:write scopes.

Types

auth_request()

@type auth_request() :: map()

Functions

create(config, token, attrs)

@spec create(MoneyHub.Config.t(), String.t(), map()) ::
  {:ok, auth_request()} | {:error, MoneyHub.Error.t()}

Creates an auth request, returning a map that includes a hosted authorisation "url" to redirect the user's browser to.

attrs carries "scope" and (optionally) "claims" - the same semantics as MoneyHub.Auth.pushed_authorisation_request/2, just expressed as a plain request body rather than builder options.

get(config, token, auth_request_id)

@spec get(MoneyHub.Config.t(), String.t(), String.t()) ::
  {:ok, auth_request()} | {:error, MoneyHub.Error.t()}

Fetches an auth request's current status by id.

list(config, token)

@spec list(MoneyHub.Config.t(), String.t()) ::
  {:ok, [auth_request()]} | {:error, MoneyHub.Error.t()}

Lists all auth requests created by this API client.

update(config, token, auth_request_id, attrs)

@spec update(MoneyHub.Config.t(), String.t(), String.t(), map()) ::
  {:ok, auth_request()} | {:error, MoneyHub.Error.t()}

Updates an auth request. Requires both auth_requests:read and auth_requests:write scopes.