0
votes

I am using react-aad-msal and msal packages for implementing authentication using azure active directory. I am able to get the access token but every time the token is validated as "Invalid token" by back-end(.net core). Server is throwing error below error.

System.UnauthorizedAccessException: Neither scope or roles claim was found in the bearer token.

I am able to access all web services by authenticating with response_type "code" in postman.

I have tried to decode the token in jwt.io. It is clearly the issue with scope. I am attaching the image of config file in react.

config

In the image, the blurred part in blue color is clientId from AAD app.

In above config, I have provided the scope, but after decoding the token I am not getting the scope field.

1
Please add your config as a text.SternK
@Yash Are you still looking for help?Shiva Keshav Varma

1 Answers

0
votes

You cannot directly request /common, because it will not be able to respond to your scope or role because you can't find the tenant you want to request the token. You should add your tenant URI (domain.onmicrosoft.com) or tenant id when requesting . enter image description here

https://login.microsoftonline.com/{your-tenant-uri-or-your-tenant-id}/oauth2/v2.0/token

enter image description here