OpenPayments.Token (open_payments_elixir v1.0.0)

Copy Markdown View Source

Management operations for issued Open Payments access tokens.

Operations use the token's management URI and value with the authenticated client's signing key. URLs are opaque; no provider path is inferred or appended. HTTPS is required unless HTTP was explicitly enabled on the client. Tokens remain per-call data; redirects and automatic retries are disabled.

Summary

Functions

Revokes an issued access token using its management URI and current value.

Rotates an issued access token using its management URI and current value.

Functions

revoke(client, token)

Revokes an issued access token using its management URI and current value.

Pass a typed AccessToken and the authenticated client holding its bound signing key. Sends one signed DELETE with GNAP authorization, no request body and no appended path. Continuation credentials cannot replace the token.

HTTP 204 returns :ok without JSON parsing or content decoding. Other success statuses are unexpected-status decoding errors. Failures carry operation :revoke_access_token, and the usual request URL/header policies apply.

Use the latest token after rotation. The authorization server checks key binding and determines revocation's effect; the SDK does not store or remove tokens, mutate the client/input, assess elapsed expiry or track grant state. Redirects and automatic retries are disabled, including after ambiguous transport failures. Grant cancellation uses OpenPayments.Grant.cancel/2.

rotate(client, token)

Rotates an issued access token using its management URI and current value.

Pass a typed AccessToken and an authenticated client holding its bound signing key. Sends one signed POST with GNAP authorization and no request body, matching Node's rotation request. Continuation credentials cannot replace the token.

HTTP 200 returns a typed TokenRotationResponse, preserving the access_token wrapper and permitted JSON extensions. Use its new token and management URI for subsequent calls. Existing request URL/header policies apply, and errors carry :rotate_access_token.

The authorization server determines token invalidation and key binding. The SDK does not store tokens, mutate the client/input, assess elapsed expiry, compare old/new access, automatically retry rotation or rotate the signing key.