I have created an app in Azure and given the below permissions to Microsoft Graph.
"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"
Hi @
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 URL
to:
Scope: https://graph.microsoft.com/.default offline_access
Auth URL:https://login.microsoftonline.com/common/oauth2/v2.0/authorize
Access Token URL:https://login.microsoftonline.com/common/oauth2/v2.0/token
Call 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
.
"error": {
"code": "InvalidAuthenticationToken",
"message": "Access token validation failure. Invalid audience.",
"innerError": {
"date": "2023-03-09T06:56:36",
"request-id": "2155e05d-bec5-4f7c-9b30-28a11f51ece4",
"client-request-id": "2155e05d-bec5-4f7c-9b30-28a11f51ece4"
Hi
@Dhruvin Moradiya
You should set the values for
Auth URL
and
Access Token URL
to:
Auth URL:https://login.microsoftonline.com/{tenant id}/oauth2/v2.0/authorize
Access Token URL:https://login.microsoftonline.com/{tenant id}/oauth2/v2.0/token
Hi
@CarlZhao-MSFT
AuthURL : https://login.microsoftonline.com/common/oauth2/authorize
Token URL : https://login.microsoftonline.com/common/oauth2/token
What changes should I make to use list files in one drive using graph API?
Hi
@CarlZhao-MSFT
Yes. It is a multi-tenant app. Building applications to access files from drives outside our organization as well. Currently, I'm making calls to my personal drive.
I have selected
Accounts in any organizational directory (Any Azure AD directory - Multitenant) and personal Microsoft accounts (e.g. Skype, Xbox)
while creating the app.
Yes. I want to make API calls to one drive.
List files, folders, edited files after given datetime, deleted files, etc.
Hi
@CarlZhao-MSFT
AuthURL : https://login.microsoftonline.com/common/oauth2/authorize
Token URL : https://login.microsoftonline.com/common/oauth2/token
Do you mean
/common
to
/{tenant_id}
?