Home > Software engineering >  https://graph.microsoft.com/v1.0/me returns 403 for other users than myself
https://graph.microsoft.com/v1.0/me returns 403 for other users than myself

Time:01-04

I have developed a small app using the API permissions

CodePudding user response:

I tried to reproduce the same in my environment and got the same error as below:

enter image description here

The error usually occurs if the user doesn't have the required permissions to perform the action:

enter image description here

To resolve the error, try the below:

I agree with DipeshJadhav, Generate the token with scope as https://graph.microsoft.com/.default :

enter image description here

The access token contains the user.read permission when decoded like below:

enter image description here

After passing the correct scope, I am able to read the user details successfully:

enter image description here

In your code try passing the scope as: scopes: ["https://graph.microsoft.com/.default"]

If still the issue persists, grant Admin consent to the API permission:

enter image description here

  • Related