azureauthenticationazure-active-directory

Error AADSTS65001 while getting access token


I have registered an application in Azure AD. I am trying to get an access token for Azure SQL Database.

I am sending the request to https://login.microsoftonline.com/mytenant/oauth2/v2.0/token

But I am getting the below error as a response.

AADSTS65001: The user or administrator has not consented to use the application with ID

Is there something wrong with the authentication request? Or am I missing any permissions? If it is how to set those permissions? I don't know what's going wrong.

Can anyone help me out to solve this error?


Solution

  • Initially please check with your admin to check if he/her had been consented to the request .

    Please make sure to give basic permissions required to access the app and grant consent for them in portal . Or make sure the admin has consented .

    enter image description here

    Also see aadsts65001 and check if scope parameter added in the request for V2 endpoint.

    See if you need to have Directory Readers role to access azure sql database(if not ask the admin to provide the same) or also select Directory.Read.All permissions from API permissions as above. or even we can set from roles and administrator section.