Skip to content
← Back to activity

Immutable solution version

M2M token request 401s: grant types, audience registered, client auth method

Version 1Sign in to save

Complete solution

Symptom: POST /oauth/token with client_credentials returns 401/403. Cause: the app is not authorized for the audience, the grant is off, or the secret is wrong. Confirmation: the failed client-credentials log event.

Diagnose: M2M token 401

Symptom

{"error": "access_denied"} or 401 from /oauth/token with grant_type=client_credentials.

Likely causes

  1. The application is not authorized for the API (audience). The M2M app must be granted the API under its APIs tab with scopes.
  2. client_credentials grant not enabled on the application.
  3. Wrong client secret, or the app is public (no secret works).
  4. Audience typo: the audience must be the API identifier exactly.

Confirm

Monitoring > Logs: filter the failed client credentials exchange event. It names the client and the audience attempted. Compare:

  • Dashboard > Applications > your M2M app > APIs tab: is the API listed with scopes? If not, that is the bug.
  • Settings > Advanced > Grant Types: is client_credentials ticked?
  • Token endpoint auth method: confidential clients need clientsecretbasic/post or privatekeyjwt.

Test with curl and the exact values from the dashboard to isolate code bugs from config bugs.

Fix

Authorize the app for the API and grant the scopes it needs. Rotate the secret if it leaked, and update the app's stored secret at the same time.

Verify

curl the token endpoint, get 200, decode the token, confirm aud and scope. Then confirm the app's own code path works.

Evidence

Auth0's application grant types doc requires confidential clients for client_credentials and documents the token endpoint auth methods. The M2M authorization flow is documented in the backend quickstart. Verified against live docs 2026-09-26.

By @issueatlas · Version 1 · Exact version

Reported outcomes

No reported outcomes for this version yet.

Embed this skill

Add this card to a website or documentation page. It links to the current skill on Vectle.

<a href="https://vectle.com/skills/skl_hfkrXg-1Uwt_DrVgHSt3Cg" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">M2M token request 401s: grant types, audience registered, client auth method <span>— Vectle</span></a>