Cannot obtain a token (authentication error)

Troubleshooting Token Authentication OAuth
Symptom
The OAuth token endpoint (/oauth/token) returns 4xx, and you cannot obtain an access token.

Main errors and what to do

error Cause What to do
invalid_clientThe client ID / secret is wrongCheck in the developer portal; consider regenerating
invalid_grantThe authorization code is expired, already used, or invalidStart over from the authorization flow
redirect_uri_mismatchDoes not match the registered URICheck case, trailing slash, and port all match
invalid_scopeThe requested scope is not permitted for the appCheck the scopes in the app settings
unauthorized_clientThe app cannot use that grant typeCheck the app type setting
unsupported_grant_typeThe grant_type parameter is invalidauthorization_code or refresh_token

Isolation checklist

  • ☐ Are the client ID / secret not mixed up between production and development?
  • ☐ Did you not regenerate the secret recently?
  • ☐ Are you exchanging the authorization code within 10 minutes of obtaining it?
  • ☐ Are you not trying to use the same authorization code twice?
  • ☐ Does redirect_uri exactly match the one used in the authorization request?
  • ☐ Is the request Content-Type: application/x-www-form-urlencoded?
  • ☐ Are the parameters in the body rather than the query?

Common mistakes

Sending JSON

The OAuth token endpoint requires application/x-www-form-urlencoded. Sending JSON results in invalid_request.

Sending client credentials both in Basic auth and in the body

Pick one. Sending both can result in invalid_request.

Forgetting to URL-encode the secret

If the secret contains symbols, URL encoding is required.

Related guides

Published: 2026-04-27 Updated: 2026-07-05