Accessing Project REST API throws error: Exception of type 'Microsoft.IdentityModel.Tokens.AudienceU

Copper Contributor

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://docs.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.

1 Reply
I have the same issue..
Asked the question on stack-overflow as well.