Phoenix auth issues short-lived access JWTs and longer-lived refresh tokens. The Rise SDK can manage the session, attach bearer tokens to authenticated requests, refresh before expiry, and persist the rotated token pair.Documentation Index
Fetch the complete documentation index at: https://docs.phoenix.trade/llms.txt
Use this file to discover all available pages before exploring further.
Lifecycle
- Request a challenge from Phoenix.
- Sign the challenge with the authority wallet.
- Exchange the signature for an auth response.
- Use
Authorization: Bearer <access_token>on authenticated routes. - Refresh with
POST /v1/auth/refreshbefore the access token expires. - Reauthenticate when refresh fails with a terminal auth error.
Endpoints
| Step | Endpoint | Body or query | Notes |
|---|---|---|---|
| Wallet nonce | GET /v1/auth/nonce?wallet_pubkey=... | query wallet_pubkey | Returns nonce_id, message, and expires_at. |
| Wallet login | POST /v1/auth/login/wallet | wallet_pubkey, signature, nonce_id | signature signs the exact nonce message. |
| Wallet transaction challenge | POST /v1/auth/wallet/transaction-challenge | wallet_pubkey | Alternative for wallets that cannot sign arbitrary messages. |
| Wallet transaction login | POST /v1/auth/login/wallet/transaction | wallet_pubkey, nonce_id, signed_transaction | Exchanges the signed memo transaction for JWTs. |
| Refresh | POST /v1/auth/refresh | refresh_token | SDKs include the current bearer token when available and store the rotated session. |
| Logout | POST /v1/auth/logout | none | Requires Authorization: Bearer <access_token> and revokes the session. |
Wallet login
This TypeScript example is written for a browser wallet that supportssignMessage.
Refresh
With a managed SDK session, refresh is normally automatic before authenticated HTTP and WebSocket requests. Manual refresh is still useful when you want to force rotation after loading a saved session.invalid_refresh_tokenrefresh_expiredsession_missing
Auth errors
Auth errors use the standard API error shape:| Error code | Status | Meaning |
|---|---|---|
missing_access_token | 401 | The route requires an authenticated access token, but none was available to the route guard. |
missing_bearer_token | 401 | The route expects an Authorization: Bearer ... header. |
invalid_access_token | 401 | The access JWT is malformed, expired, signed by an unknown key, or otherwise failed verification. |
access_token_expired | 401 | The access token is expired. Refresh and retry. |
session_missing | 401 or 404 | The server-side session was revoked, expired, or missing. Reauthenticate. |
access_jti_mismatch | 401 | The access token is no longer the current token for the session. Refresh or reauthenticate. |
invalid_refresh_token | 401 | The refresh token is invalid, expired, or already consumed. Reauthenticate. |
refresh_expired | SDK-side | The SDK knows the stored refresh token is past its expiry. Reauthenticate. |
no_auth_session | SDK-side | Auth was enabled, but no session is loaded. Sign in first. |
user_only | 403 | The route requires user auth. |
admin_only | 403 | The route requires admin auth. |
insufficient_role | 403 | The authenticated role cannot access the route. |