Forum Discussion
philipp_eddp
Dec 01, 2021Copper Contributor
Accessing Project REST API throws error: Exception of type 'Microsoft.IdentityModel.Tokens.AudienceU
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.
- patrickluetzeCopper Contributor
Hi anush_prod
yes, I found a solution. See the answer on this Stack Overflow post: https://stackoverflow.com/questions/76868583/how-to-authorise-to-ms-project-odata-api-by-using-clientcredentialflow - anush_prodCopper Contributor
I have the same issue too. Did you find a solution? Graph API still doesn't support the Project Online endpoint.
- patrickluetzeCopper ContributorI have the same issue..
Asked the question on stack-overflow as well.