Share via

Accessing Project REST API throws error: Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown.

Philipp Reske 116 Reputation points
2021-12-01T06:42:30.687+00:00

I am trying to access the Project Online REST API

http://ServerName/ProjectServerName/_api/ProjectData/Projects

More precisely my query is the following

"https://" + sharepoint_url + "/sites/pwa/_api/ProjectServer/Projects('" + project_id + "')/Assignments('" + project_task_id + "')/Resource"

Now what I am challenges with, is the right authentication.

I am trying to impersonate two natural users, the application is registered in AAD and I also get a token.

But I get either one of the two errors

{"error_description":"Unsupported security token."}

or

{"error_description":"Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown."}

I am happy to provide further details, but I am a bit lost in the API jungle from Microsoft. Unfortunately it appears that Graph API does not (yet?) support Project Online.

I was already following those guides here:

https://learn.microsoft.com/de-de/azure/active-directory/develop/v2-oauth2-client-creds-grant-flow

http://pratapreddypilaka.blogspot.com/2018/05/sharepoint-online-authentication-for.html

No positive result. I do get tokens, but the errors remain.

Microsoft 365 and Office | SharePoint | For business | Windows
0 comments No comments

Answer accepted by question author

Philipp Reske 116 Reputation points
2021-12-01T06:45:27.577+00:00

Sorry, I was posting this earlier already https://learn.microsoft.com/en-us/answers/questions/643384/project-online-api-usage-authentication-challenge.html#answer-643418 and was attempting to check with Technet. Noticed too late that this here became Technet.

But also asked it now in the Project Techcommunity: https://techcommunity.microsoft.com/t5/project/accessing-project-rest-api-throws-error-exception-of-type/m-p/3021395#M2498

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

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