Generate Authorization Code
Authentication
Generate Authorization Code
Third step of OAuth 2.0 flow - generate authorization code from JWT and access tokens
POST
Generate Authorization Code
Overview
Called after user authentication to generate an authorization code. This endpoint requires two different tokens:- JWT Token (in request body): Session token from Step 1
- 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
Your public API client key
Bearer token from
POST /v1/auth/loginFormat: Bearer ACCESS_TOKENBody
JWT session token from Step 1Format: JWTExample:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...Response
Complete redirect URL with authorization codeExample:
https://yourapp.com/callback?state=random_csrf&code=auth_code_xyzAuthorization code (single-use, exchange in Step 4)Example:
auth_code_xyz123CSRF protection token from Step 1 (verify this matches)Example:
random_csrf_protection_string_12345Code Examples
Next Steps
Step 4: Token Exchange
Exchange authorization code for access and refresh tokens