Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' in Sharepoint API

Steve 0 Reputation points
2024-07-16T12:38:22.9433333+00:00

I've seen a few posts about this but I haven't seen a working answer yet.
When using the Sharepoint API, I get the following error:
'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException'

I am able to get the access token but any other calls seem to fail. From other answers I've seen, it looks like a permission issue where the app doesn't have the necessary permissions. I've tried adding the following XML permission command using the global admin account but that also seems to fail:
<AppPermissionRequests AllowAppOnlyPolicy="true">
<AppPermissionRequest Scope="http://sharepoint/content/sitecollection" Right="FullControl" />
</AppPermissionRequests>

  • The above fails because the button to enable it is disabled if I navigate to the site specific page, if I go to the global page its enabled but saving the permission doesn't do anything

Do you have any recommendations on how to proceed?

Thanks,
Steve

SharePoint
SharePoint
A group of Microsoft Products and technologies used for sharing and managing content, knowledge, and applications.
10,652 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Yanli Jiang - MSFT 25,861 Reputation points Microsoft Vendor
    2024-07-17T08:37:31.84+00:00

    Hi @Steve ,Based on your description, this is very strange. I suggest you try the steps in this article:https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azureacs to see if the problem can be solved.

    If the problem persists, you can try the methods in this article:

    https://learn.microsoft.com/en-us/sharepoint/dev/solution-guidance/security-apponly-azuread

    Have a nice day!


    If the answer is helpful, please click "Accept as Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


  2. Yanli Jiang - MSFT 25,861 Reputation points Microsoft Vendor
    2024-07-19T08:55:47.65+00:00

    Hi @Steve ,

    This is very strange. Since the forum has limited permissions, we suggest you open a ticket to check the background log to see what the reason is.

    The support team over there has the correct escalation channel, they can involve more resource and investigate the behavior from back end as fast as possible. They also can check the behavior on your end remotely.

    Hope the problem can be solved soon. Have a nice day!


    If the answer is helpful, please click "Accept as Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.