How to solve InvalidAuthenticationToken error
I have created an app in Azure and given the below permissions to Microsoft Graph.
- APIConnectors.Read.All
- Files.Read
- Files.Read.All
- Files.ReadWrite.All
- offline_access
- User.Read
https://graph.microsoft.com/v1.0/me/drive/root/children. I’m making a GET request to list files and folders in one drive root folder. But I’m getting the below error.
{
"error": {
"code": "InvalidAuthenticationToken",
"message": "Access token validation failure. Invalid audience.",
"innerError": {
"date": "2023-03-09T06:01:36",
"request-id": "0e614c70-c557-4599-8707-8351352cfcbd",
"client-request-id": "0e614c70-c557-4599-8707-8351352cfcbd"
}
}
}
Am I doing anything wrong here?
-
CarlZhao-MSFT27,206Reputation pointsMar 9, 2023, 2:27 PMHi @Dhruvin Moradiya
This indicates that the API audience of your access token is inconsistent with the API endpoint you are calling.
When you get an access token, you should set the values of
Scope,Auth URL,Access Token URLto:Scope: https://graph.microsoft.com/.default offline_accessAuth URL:https://login.microsoftonline.com/common/oauth2/v2.0/authorizeAccess Token URL:https://login.microsoftonline.com/common/oauth2/v2.0/tokenCall the Graph API:
Hope this helps.
If the reply is helpful, please click Accept Answer and kindly upvote it. If you have additional questions about this answer, please click Comment.
