Azure registered app error: The user or administrator has not consented to use the application with ID

6.1k views Asked by At

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 ?

1

There are 1 answers

4
Sridevi On BEST ANSWER

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