Entra ID access token has the Microsoft Graph audience instead of my API
aud: 00000003-0000-0000-c000-000000000000Short answer
The aud claim names the API a token is for, and the scope you request decides it. If the request has no resource in the scope, Microsoft assumes Microsoft Graph, whose id is 00000003-0000-0000-c000-000000000000. Request a scope that belongs to your own API, and have your API accept only tokens with its own audience.
Fix it fast
1Find out which cause you have
Decode the access token for debugging only, and read aud and scp. Microsoft documents jwt.ms for this. Do not paste production tokens into other sites.
# open https://jwt.ms and paste a token from a test account; read the aud and scp claims2Match what you see, then jump to its fix
- 1
Your login request uses scopes such as User.Read or openid only, and the token aud is the Graph idThe scope names no resource, so Graph is assumedFix - 2
Your backend rejects the token while Graph itself accepts itThe access token is meant for Graph and your API tries to validate itFix - 3
An error about combining scope types, or a token whose aud is a different resource than the one you asked forStatic .default is mixed with other scopes, or points at the wrong resourceFix
- 1
What does the error look like?
aud: 00000003-0000-0000-c000-000000000000Access token audience is Microsoft Graph, not my APISignature validation of the token fails in my backend
Cause 1 of 3
The scope names no resource, so Graph is assumed
1Check
Microsoft's scope documentation says that if the resource identifier is left out of the scope parameter, the resource is assumed to be Microsoft Graph. So scope=User.Read means https://graph.microsoft.com/User.Read.
grep -rn "scopes" src/ | head2Fix
Ask for a permission that belongs to your API: the API's application ID URI, a slash, and the scope name you exposed.
// MSAL request object
const request = {
scopes: ["<application-id-uri>/<scope-name>"],
};3Verify
Acquire a new token, decode it and confirm that aud is now your API's identifier.
# decode the new token at https://jwt.ms and compare aud with your API's application ID URIConfirmed by learn.microsoft.com
Cause 2 of 3
The access token is meant for Graph and your API tries to validate it
1Check
Microsoft says a web API must accept only tokens that carry one of its own application ID URIs in aud, and that Graph tokens cannot be validated by the normal rules. Accepting a token for another resource is the confused deputy problem.
# in your API: log the aud claim of the rejected token and compare it with your own application ID URI2Fix
Send your API a token requested for the API's own scope, as above, and keep audience checking on in the API instead of switching it off.
// client: attach the token of the API scope
const result = await instance.acquireTokenSilent({ scopes: ["<application-id-uri>/<scope-name>"], account });
fetch("/api/data", { headers: { Authorization: `Bearer ${result.accessToken}` } });3Verify
The API accepts the new token and returns data.
curl -H "Authorization: Bearer $TOKEN" https://api.example.com/dataConfirmed by learn.microsoft.com
Cause 3 of 3
Static .default is mixed with other scopes, or points at the wrong resource
1Check
The .default scope refers to a whole resource, written as the resource identifier plus /.default. Microsoft's documentation says clients cannot combine that static consent with individual scopes in one request, for example Graph .default together with Mail.Read.
grep -rn "\.default" src/2Fix
Use one resource per token request. Make a separate request for each API, each with its own scopes.
const apiToken = await instance.acquireTokenSilent({ scopes: ["<application-id-uri>/.default"], account });
const graphToken = await instance.acquireTokenSilent({ scopes: ["User.Read"], account });3Verify
Decode both tokens and check that each aud matches the resource you wanted.
# decode at https://jwt.msConfirmed by learn.microsoft.com
How do I stop it coming back?
- Treat access tokens as opaque in the client and validate only in the API that owns the audience.
- Request Graph scopes and your own API scopes in separate token requests.
- Expose the API's scopes in the app registration before the client asks for them.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Which stack is behind this page?
Projects of mine built on the same technologies:
- TaxiDexMy own multi-tenant taxi dispatch SaaS: API, dispatcher portal, driver and passenger apps, and the servers underneath.
- QistLockA NestJS and React SaaS driving an Android Device Owner agent that locks financed phones when payments lapse.
- TaskvareA task and project-management suite: React on the web, Flutter on mobile, TypeScript underneath.
Related fixes
Web apps
Error acquiring a token in a React app that signs in with Azure
Interaction is currently in progress. Please ensure that this interaction has been completed before calling an interactive API.
Read the MSAL error code first; it names the cause.
4 causes, each with a fixWeb apps
Module not found for antd/dist/antd.less after upgrading to Ant Design 5
Module not found: Error: Can't resolve 'antd/dist/antd.less'
Ant Design 5 dropped Less and the bundled CSS file for CSS-in-JS, so antd/dist/antd.less no longer exists.
3 causes, each with a fixWeb apps
Astro Code component fails inside a React component
Astro components cannot be rendered directly via function call
Astro components such as Code only exist on the server and render static HTML.
2 causes, each with a fixWeb apps
React shows Attempted import error when importing a component or function
Attempted import error:
The build found the file but not the name you asked for.
2 causes, each with a fixWeb apps
How to catch and handle a 422 from Axios in a Redux thunk
action.error.message is 'Rejected' and action.payload is undefined
A 422 means the server read the request but cannot process its content, so repeating it unchanged fails again.
4 causes, each with a fixWeb apps
axios gets 429 Too Many Requests from a React app
429 (Too Many Requests)
A 429 comes from the server or an API gateway, not from axios: your client sent too many requests in a window.
4 causes, each with a fix