Hi
I got a solution from microsoft. Following problem in my app registration:
I defined a scope from Graph API: User.Read User.ReadBasic.All Mail.Read
If a scope will be set from Graph API, the token can just be validated from Graph!
You can see that in jwt.io. If the aud is like "00000003-0000-0000-c000-000000000000" the token is from Graph.
What I had to do to solve the problem:
- To protect our own custom API, I had to register an application to represent it on Azure AD and obtain an access_token/id_token for it. As I did it already bevor.
- Section - Expose an API: Create a new scope: name = access_as_user
- Section - API permissions: Add a new permission for my registered application and my scope access_as_user
- Section - Manifest: Change entry "accessTokenAcceptedVersion" from null to 2
- Check the new token from azure with jwt.io. If the aud is equal the registered application id the token can be successfull validated.
That's it. Hope it helps all other who are searching a solution for a problem like that.
Best regards
Harald