For authentication setup and code examples, see the main Authentication guide.
Common Authentication Errors
”401 Unauthorized”
Your JWT token is missing, invalid, or expired. Check:- Is the token included in the
Authorization: Bearer <token>header? - Has the token expired? Tokens are typically valid for 180 seconds (3 minutes)
- Is the token format correct? Should be
Bearer eyJ... - Was the token issued by the correct Auth0 domain for your environment?
”403 Forbidden”
Your token is valid but doesn’t have the required scope for the endpoint. Check:- Decode your token at jwt.io to see which scopes you have
- Verify the endpoint requires a scope you have (see Authentication scopes)
- Scopes must be space-separated in the
scopeclaim (e.g.,"read:orders write:orders")
”invalid_client”
JWT signature verification failed when requesting an access token from Auth0. Causes:- Private key doesn’t match the public key registered with Polymarket
- Wrong private key file being used
- Private key file corrupted or invalid format
”invalid_client_assertion”
The client assertion JWT is malformed or has incorrect claims. Common causes:- Wrong
audclaim (must behttps://pmx-{env}.us.auth0.com/oauth/token, NOT the API URL) - Expired
expclaim (expiration in the past) - Missing required claims (
iss,sub,aud,iat,exp,jti) - Reused
jti(must be unique for each request) - Wrong signing algorithm (must be RS256)
Environment-Specific Issues
Using Wrong Environment Credentials
Problem: Using development credentials in production (or vice versa). Symptoms:invalid_clienterrors401 Unauthorizedon API calls- Token works in one environment but not another
- Separate key pairs (different public/private keys)
- Separate Client IDs
- Separate Auth0 domains
- Separate API audiences
| Environment | Auth Domain | API Audience |
|---|---|---|
| Development | pmx-dev01.us.auth0.com | https://api.dev01.polymarketexchange.com |
| Pre-production | pmx-preprod.us.auth0.com | https://api.preprod.polymarketexchange.com |
| Production | pmx-prod.us.auth0.com | https://api.polymarketexchange.com |
Cannot Reuse Keys Across Environments
Environments are completely isolated. You cannot:- Use the same private key in multiple environments
- Use preprod credentials in production
- Transfer Client IDs between environments
Token Expiration Issues
Token Works Sometimes But Not Others
Cause: Token is expiring mid-session. Solution: Implement proactive token refresh:Token Expired Immediately After Creation
Cause: System clock is incorrect. Check: Is your system time synchronized?JWT Claim Issues
Wrong Audience Claim
Common mistake: Using API URL as theaud claim in the client assertion.
Incorrect:
Reused JTI
Problem: Using the samejti (JWT ID) for multiple requests.
Cause: jti is meant to prevent replay attacks and must be unique per request.
Solution: Generate a new UUID for each token request:
Verifying Token Claims
Decode your access token to check what scopes and claims you have:Authorization vs Authentication
Authentication proves who you are (which firm). Authorization determines what you can do (which accounts, which scopes). You may be authenticated but not authorized to:- Access specific trading accounts
- Call certain endpoints (missing scopes)
- Perform certain actions (insufficient permissions)
Cryptographic Issues
Wrong Key Format
Private keys must be in PEM format:Wrong Algorithm
You must use RS256 (RSA with SHA-256) to sign your JWT. Don’t use:- HS256 (HMAC - symmetric key)
- Other RSA variants (RS384, RS512, PS256, etc.)
Testing Authentication
Test your authentication setup: 1. Verify you can create a client assertion:Getting Help
If authentication issues persist:- Verify your credentials match your environment
- Decode and inspect your JWTs (client assertion and access token)
- Check system clock is synchronized
- Test with curl commands to isolate client code issues
- Contact support with:
- Environment (dev, preprod, prod)
- Client ID
- Error messages
- Decoded JWT claims (never share your private key!)

