2

We´re trying to get the token for Oauth using the official docs request:

https://login.microsoftonline.com/{tenant}/oauth2/v2.0/authorize?
client_id='my client id'
&scope=https%3A%2F%2Fgraph.microsoft.com%2Fmail.read
&redirect_uri=http%3A%2F%2Flocalhost%2Fmyapp%2F
&code='my auth code obtained in previous auth request'
&grant_type=authorization_code
&client_secret='my client secret'

But when we make the request it responds with this error:

AADSTS65001: The user or administrator has not consented to use the application with ID 'mya app id' named 'my app name'. Send an interactive authorization request for this user and resource"

Thing is, we already gave them this permissions on Azure portal AD and app registration even with the admin consent but still:

enter image description here

is there any permission missing there ?, any clue about this ?

jsanchezs
  • 1,992
  • 3
  • 25
  • 51

1 Answers1

2

I have tried in my environment and got the access token successfully. Please check whether you followed the same steps as below:

1) Go to Azure portal -> Azure AD -> App registrations -> Your app -> Authentication -> check the below options -> Save.

enter image description here

2) To resolve the error, make sure to grant below Api permissions along with permissions you have given:

enter image description here

3) To get the token, I used postman by giving parameters like below:

enter image description here

4) I successfully got the token like below:

enter image description here

After every change, try refreshing your Azure Portal and Postman.

For more in detail, please refer below links:

Microsoft identity platform and OAuth 2.0 authorization code flow - Microsoft identity platform | Microsoft Docs

azure - AADSTS65001: The user or administrator has not consented to use the application with ID ' - Stack Overflow

Sridevi
  • 10,599
  • 1
  • 4
  • 17
  • Thanks for your kind answer, already added those 3 new permissions, checked the boxes you marked and did exactly the same request on postman but got the same error, any other idea about what could I be missing ? – jsanchezs Apr 21 '22 at 14:53
  • 1
    After getting that error whatever changes we do in Azure Portal, those are not getting reflected in Postman. I tried creating new application and assigned all those permissions, got token successfully without any error. Try to do same and check if it helps! – Sridevi Apr 21 '22 at 15:02
  • Worked like a charm !, thank you !! – jsanchezs Apr 21 '22 at 16:09
  • Glad it helped....Tqs for the update !! – Sridevi Apr 22 '22 at 03:08