Endpoint
Content Type
Grant Types
This endpoint supports two grant types:- authorization_code - Exchange authorization code for tokens
- refresh_token - Refresh an expired access token
Authorization Code Grant
Exchange an authorization code for access and refresh tokens.Request Parameters
Must be
authorization_codeThe authorization code received from
/oauth2/authorizeYour agent ID (obtained during registration)
Must exactly match the redirect_uri used in authorization request
The PKCE code verifier (OAuth 2.1 requirement)
Optional for public clients. Required for confidential clients.
Example Request
Success Response
JWT access token for making authenticated API requests
Always
BearerToken lifetime in seconds (typically 3600 = 1 hour)
Long-lived token for refreshing the access token
Space-separated list of granted scopes
Response
Refresh Token Grant
Refresh an expired access token using a refresh token.Request Parameters
Must be
refresh_tokenThe refresh token received from a previous token response
Your agent ID
Optional for public clients
Example Request
Success Response
Response
Refresh tokens are not rotated by default. The same refresh token can be
used multiple times.
Error Responses
Missing or invalid required parameters
Invalid authorization code, expired code, or PKCE verification failed
Invalid client_id or client_secret
Grant type not supported (OAuth 2.1 only supports
authorization_code and refresh_token)Common Issues
PKCE verification failed
PKCE verification failed
Cause: Code verifier doesn’t match the original code challengeSolutions:
- Ensure you’re using the same verifier that generated the challenge
- Check that the verifier is stored correctly in sessionStorage
- Verify the SHA-256 hashing is implemented correctly
Authorization code has expired
Authorization code has expired
redirect_uri does not match
redirect_uri does not match
Cause: Redirect URI doesn’t exactly match the one used in authorizationSolution: Ensure exact match including protocol, domain, port, and path
Invalid refresh token
Invalid refresh token
Cause: Refresh token expired (30 days) or revokedSolution: User must re-authenticate via
/oauth2/authorizeToken Lifetime
| Token Type | Lifetime | Notes |
|---|---|---|
| Authorization Code | 10 minutes | Single use only |
| Access Token | 1 hour | Can be refreshed |
| Refresh Token | 30 days | Long-lived |
Security Notes
- Authorization codes are single-use and expire quickly - Always use PKCE (required by OAuth 2.1) - Store refresh tokens securely - Never expose tokens in URLs or logs