x-app-id header, and a user, with an
access token in Authorization: Bearer <accessToken>. Market data and quotes without a user need
only the app. Balances, deposits, trading, and withdrawals need a user. See
Base URL, app IDs & API keys for which headers go on which call.
Users sign in on the client, and your backend includes that user’s access token on trading calls.
Wallet sign-in (SIWE) is the Quickstart: REST.
Sign-in methods
Other providers: Sign-in providers.
OAuth, email, and Privy
OAuth and email both finish withPOST /auth/token/exchange using the code from the
redirect. Exchange it on your callback page or backend. Email sends the link from
POST /auth/start. Privy skips start and calls
POST /auth/verify.
redirectUrl on email and OAuth must be an allowed origin. It is where ?code= is delivered.
Start OAuth in the browser with POST /auth/start so the callback can use its proof cookie.
Tokens
The access token is bound to the app that issued it. Using it with another app’s
x-app-id fails.
The SDK stores the session and adds the header for you. In the browser, set
authDelivery: "cookie-refresh" on createAggClient to keep the refresh token in an HttpOnly
cookie scoped to the AGG API host and /auth routes. In that mode verify() and
exchangeAuthCode() can omit refreshToken from the JSON response.
If your backend already holds a user’s tokens, seed an SDK client with
client.setSession({ accessToken, refreshToken }).
Refresh a session
When a user-tier call returns401, refresh once and retry. If the refresh also fails, sign the
user in again.
Sign out
POST /auth/sign-out with the user’s token revokes all of that user’s tokens. client.signOut()
also clears the stored session.
Sign out.
Sign-in errors
OAuth and email report that same 20-user cap on the redirect URL, not as the verify
403. See
Base URL, app IDs & API keys.
Related
Sign-in providers
OAuth, email, Privy, and wallet provider setup.
Account linking
Add more sign-in methods or wallets to one user.
User avatars
Upload, confirm, and remove a profile image for the signed-in user.