Microsoft Graph rejects an access token with an invalid audience
Access token validation failure. Invalid audience.Short answer
Every access token is issued for one audience, shown in its aud claim. Graph accepts only tokens whose audience is Graph, and your API accepts only tokens meant for it. Decode the token to read aud, then request the token with the scope of the API you are calling. A middle-tier API exchanges its token with the on-behalf-of flow.
Fix it fast
1Find out which cause you have
Decode the token you send and read the aud claim. It must name the API that receives the call. For debugging only, paste a token for your own tenant into the Microsoft decoder.
# open https://jwt.ms and paste the access token2Match what you see, then jump to its fix
- 1
aud shows your app's client ID or api:// URI, and the call goes to graph.microsoft.comThe token was requested for your own API but is sent to GraphFix - 2
The error comes from your own validation code and aud holds Microsoft GraphYour API received a token meant for Graph, or for another APIFix - 3
Graph rejects the call and the forwarded token has your API as audYour API forwards the caller's token to Graph instead of exchanging itFix - 4
The token is for your API but validation still says invalid audienceYour API checks aud in a different format than the token usesFix
- 1
What does the error look like?
Access token validation failure. Invalid audience.
Cause 1 of 4
The token was requested for your own API but is sent to Graph
1Check
The scope in the token request sets the audience. A scope like api://<your-api>/access_as_user gives a token for your API, not for Graph.
# jwt.ms: compare aud with the host you call2Fix
Ask for a token with a Graph scope. If the resource part of the scope is left out, Microsoft Graph is assumed. You can also use the .default scope with the Graph identifier.
scope=https://graph.microsoft.com/User.Read
scope=https://graph.microsoft.com/.default3Verify
Decode the new token and check aud, then call Graph.
curl -H "Authorization: Bearer $TOKEN" https://graph.microsoft.com/v1.0/meConfirmed by learn.microsoft.com
Cause 2 of 4
Your API received a token meant for Graph, or for another API
1Check
A web API must accept only tokens whose aud is its own identifier. Accepting a token meant for another resource is the confused deputy problem, and Graph tokens cannot be validated like normal JWTs.
# compare aud in the failing token with your API's Application ID URI2Fix
Have the client request a token for your API's scope, and keep audience validation on. Do not accept or parse tokens issued for APIs you do not own.
scope=api://<your-api-client-id>/access_as_user3Verify
The client's new token has your API as aud and passes validation.
# jwt.ms: aud equals your Application ID URI or client IDConfirmed by learn.microsoft.com
Cause 3 of 4
Your API forwards the caller's token to Graph instead of exchanging it
1Check
A token for your API cannot be redeemed for another app by forwarding it. The middle tier must use the on-behalf-of flow, with the incoming token as the assertion, and ask for Graph scopes.
# inspect the Authorization header your API sends to Graph2Fix
Send an on-behalf-of request to the token endpoint, then call Graph with the new token. Prefer MSAL, which does this for you.
POST https://login.microsoftonline.com/<tenant>/oauth2/v2.0/token
grant_type=urn:ietf:params:oauth:grant-type:jwt-bearer
client_id=<api-client-id>
client_secret=<api-secret>
assertion=<token received by your API>
scope=https://graph.microsoft.com/user.read
requested_token_use=on_behalf_of3Verify
Call Graph with the token from the response.
curl -H "Authorization: Bearer $NEW_TOKEN" https://graph.microsoft.com/v1.0/meConfirmed by learn.microsoft.com
Cause 4 of 4
Your API checks aud in a different format than the token uses
1Check
In v1 access tokens aud can be an App ID URI, with or without a trailing slash, or the client ID. In v2 tokens it is the client ID. The version comes from requestedAccessTokenVersion in the API's manifest.
# Entra admin center > App registrations > your API > Manifest > requestedAccessTokenVersion2Fix
Accept the exact aud values your API can receive, or set requestedAccessTokenVersion to 2 so aud is always the client ID.
"requestedAccessTokenVersion": 23Verify
Request a new token and decode it; aud is the client ID.
# jwt.msConfirmed by learn.microsoft.com
How do I stop it coming back?
- Write the audience each client must request next to the API in your documentation.
- Keep audience validation on in every API; never disable it to make an error go away.
- Use MSAL for token requests and the on-behalf-of exchange instead of hand-built requests.
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.
Related fixes
Security
Entra ID token request fails: the request body must contain the parameter 'grant_type'
AADSTS900144: The request body must contain the following parameter: 'grant_type'.
The token endpoint did not find grant_type in the form body of your POST.
3 causes, each with a fixSecurity
Angular HttpClient does not add the X-XSRF-TOKEN header to a request
403 Forbidden on POST, PUT or DELETE while GET works
Angular copies the XSRF-TOKEN cookie into an X-XSRF-TOKEN header only for mutating requests to the same origin, and only when the cookie is readable by script.
5 causes, each with a fixSecurity
An [Authorize] endpoint rejects a request with a bearer token
Authorization Header sent: no Bearer token sent.
An [Authorize] endpoint without a policy name requires an authenticated user.
4 causes, each with a fixSecurity
ASP.NET Core API rejects an Angular user's token: the signature key was not found
401 Unauthorized
The API looked for the key named by the token's kid in the key set it downloaded from your Authority, and the key was not there.
4 causes, each with a fixSecurity
ASP.NET Core rejects the token before checking it: IDX12741, three segments expected
401 Unauthorized
IDX12741 means the string the API pulled out of the Authorization header is not shaped like a JWT: a signed token has three dot-separated parts and an encrypted one has five.
3 causes, each with a fixSecurity
A Microsoft Entra access token shows Invalid Signature when you check it yourself
Tokens that a Microsoft API receives might not always be a JWT that can be decoded
A token issued for Microsoft Graph is not meant for you to validate, so a failed signature check is expected.
2 causes, each with a fix