Skip to main content
POST
Generate Authorization Code

Overview

Called after user authentication to generate an authorization code. This endpoint requires two different tokens:
  1. JWT Token (in request body): Session token from Step 1
  2. Access Token (in Authorization header): User access token from Step 2
In hosted UI mode, this endpoint is called automatically. In API-mode, your application calls this directly.

Request

Headers

string
required
Your public API client key
string
required
Bearer token from POST /v1/auth/loginFormat: Bearer ACCESS_TOKEN

Body

string
required
JWT session token from Step 1Format: JWTExample: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...

Response

string
Complete redirect URL with authorization codeExample: https://yourapp.com/callback?state=random_csrf&code=auth_code_xyz
string
Authorization code (single-use, exchange in Step 4)Example: auth_code_xyz123
string
CSRF protection token from Step 1 (verify this matches)Example: random_csrf_protection_string_12345

Code Examples

Next Steps

Step 4: Token Exchange

Exchange authorization code for access and refresh tokens