client_secret to authenticate when exchanging the authorization code for tokens. Use this flow when your application runs on a server and can securely store credentials — for example, Node.js, Python, or PHP backends.
Prerequisites
Before you implement this flow, ensure you have:- OAuth2 client credentials — Register your app in Client Center / Manage Account to get
client_idandclient_secret - Redirect URI — Must be pre-registered in Client Center / Manage Account and must exactly match (protocol, host, path, trailing slashes)
- Server-side runtime — Node.js 18+, Python 3.8+, or equivalent for your language
- Session or secure storage — To persist
statebetween redirect and callback, and to store tokens after exchange
Step 1: Build the authorization URL and redirect
Redirect the user to the Aries authorization endpoint. They will see a login and consent screen where they can approve or deny the requested permissions. Endpoint:https://app.aries.com/oauth2/authorize
Required query parameters:
Always generate a new, cryptographically random
state for each authorization request and verify it when the user returns. This prevents CSRF attacks.Step 2: Handle the callback
After the user approves, Aries redirects to yourredirect_uri with an authorization code and the state you provided. If the user denies access, you receive error parameters instead.
Success callback:
Step 3: Exchange the code for tokens
Send the authorization code to the token endpoint to receive an access token and refresh token. The code is single-use — exchange it immediately after receiving it. Endpoint:POST https://api.aries.com/v1/oauth2/token
Request body:
access_token, refresh_token, and expires_in (use it to compute expiry time). Replace your stored refresh_token if a new one is returned.
Step 4: Make authenticated API requests
Include the access token in theAuthorization header for every API request.
Step 5: Refresh the access token
Access tokens expire afterexpires_in seconds (typically 1 hour). Use the refresh token to obtain a new access token without requiring the user to log in again. Refresh proactively before expiry.
Endpoint: POST https://api.aries.com/v1/oauth2/token
Request body:
refresh_token is returned, persist it — it replaces the previous one.
Complete example (Node.js)
Here is a minimal Express.js server demonstrating the full flow:Node.js
Next steps
OAuth2 Overview
Scopes, security, rate limits, and troubleshooting.
PKCE Flow
Implement OAuth2 for SPAs and mobile apps.
Token API Reference
Interactive token endpoint reference.
Quick Start
Get started in minutes.