Open barclayadam opened 3 days ago
I have been experiencing the same problem using Word as the host. It matches the KeyId but signature validation fails anyway.
Hi @barclayadam, If you request any Graph scopes (this includes openid and profile if selected from Graph delegated permissions) then the JWT will be intended to be validated by Graph.
Are you trying to use the NAA token in an on-behalf-of (OBO) flow to a middle-tier server? In that case you need to have a scope specific to your resource such as access_as_user. Then the token will be configured as expected for your middle-tier to validate it. You'd need to follow the app registration pattern here except you are using NAA and not the getAccessToken API.
I also recommend asking questions about configuring the NAA OBO flow scenario based on Microsoft identity team help.
Hope this helps, David
When creating an NAA token the generated token cannot be validated as a valid JWT using the keys from https://login.microsoftonline.com/common/discovery/keys
Your Environment
Expected behavior
A validatable token (where the signing key being produced is correct) to be generated. We are migrating from legacy tokens to NAA. We only use the tokens as an SSO exchange on our platform, we have no need to use the tokens with Graph or other MS products.
Current behavior
We get quite different JWTs depending on the scopes requested (we do not need to call Graph so would prefer only the
openid
andprofile
scopes)No Graph (scope
['openid', 'profile']
)The token generated is for audience https://outlook.office.com. I cannot successfully validate (server-side .net) the token, with error message
Microsoft.IdentityModel.Tokens.SecurityTokenInvalidSignatureException: IDX10511: Signature validation failed. Keys tried: 'Microsoft.IdentityModel.Tokens.X509SecurityKey, KeyId: '3PaK4EfyBNQu3CtjYsa3YmhQ5E0', InternalId: '3PaK4EfyBNQu3CtjYsa3YmhQ5E0'. , KeyId: 3PaK4EfyBNQu3CtjYsa3YmhQ5E0
Graph (scope
['User.Read', 'openid', 'profile']
)The token generated is for audience
00000003-0000-0000-c000-000000000000
, but I still cannot validate it, with the same error above.I saw some references to validating Graph-bound tokens at https://github.com/AzureAD/azure-activedirectory-identitymodel-extensions-for-dotnet/issues/609#issuecomment-405683736 but have not investigated whether this is the same problem I'm seeing yet.
The C# code for validation is:
Steps to reproduce
Thank you for taking the time to report an issue. Our triage team will respond to you in less than 72 hours. Normally, response time is <10 hours Monday through Friday. We do not triage on weekends.