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

%3CLINGO-SUB%20id%3D%22lingo-sub-3021395%22%20slang%3D%22de-DE%22%3EAccessing%20Project%20REST%20API%20throws%20error%3A%20Exception%20of%20type%20'Microsoft.IdentityModel.Tokens.AudienceU%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-3021395%22%20slang%3D%22de-DE%22%3E%3CDIV%20class%3D%22%22%3E%3CP%3EI%20am%20trying%20to%20access%20the%20Project%20Online%20REST%20API%3C%2FP%3E%3CP%3E%3CA%20href%3D%22http%3A%2F%2FServerName%2FProjectServerName%2F_api%2FProjectData%2FProjects%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3E%3CSTRONG%3Ehttp%3A%2F%2FServerName%2FProjectServerName%2F_api%2FProjectData%2FProjects%3C%2FSTRONG%3E%3C%2FA%3E%3C%2FP%3E%3CP%3EMore%20precisely%20my%20query%20is%20the%20following%3C%2FP%3E%3CP%3E%3CSTRONG%3E%22https%3A%2F%2F%22%20%2B%20sharepoint_url%20%2B%20%22%2Fsites%2Fpwa%2F_api%2FProjectServer%2FProjects('%22%20%2B%20project_id%20%2B%20%22')%2FAssignments('%22%20%2B%20project_task_id%20%2B%20%22')%2FResource%22%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3ENow%20what%20I%20am%20challenges%20with%2C%20is%20the%20right%20authentication.%3C%2FP%3E%3CP%3EI%20am%20trying%20to%20impersonate%20two%20natural%20users%2C%20the%20application%20is%20registered%20in%20AAD%20and%20I%20also%20get%20a%20token.%3C%2FP%3E%3CP%3EBut%20I%20get%20either%20one%20of%20the%20two%20errors%3C%2FP%3E%3CP%3E%3CSTRONG%3E%7B%22error_description%22%3A%22Unsupported%20security%20token.%22%7D%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3Eor%3C%2FP%3E%3CP%3E%3CSTRONG%3E%7B%22error_description%22%3A%22Exception%20of%20type%20'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException'%20was%20thrown.%22%7D%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EI%20am%20happy%20to%20provide%20further%20details%2C%20but%20I%20am%20a%20bit%20lost%20in%20the%20API%20jungle%20from%20Microsoft.%20Unfortunately%20it%20appears%20that%20Graph%20API%20does%20not%20(yet%3F)%20support%20Project%20Online.%3C%2FP%3E%3CP%3EI%20was%20already%20following%20those%20guides%20here%3A%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fde-de%2Fazure%2Factive-directory%2Fdevelop%2Fv2-oauth2-client-creds-grant-flow%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2Fdocs.microsoft.com%2Fde-de%2Fazure%2Factive-directory%2Fdevelop%2Fv2-oauth2-client-creds-grant-flow%3C%2FA%3E%3C%2FP%3E%3CP%3E%3CA%20href%3D%22http%3A%2F%2Fpratapreddypilaka.blogspot.com%2F2018%2F05%2Fsharepoint-online-authentication-for.html%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3Ehttp%3A%2F%2Fpratapreddypilaka.blogspot.com%2F2018%2F05%2Fsharepoint-online-authentication-for.html%3C%2FA%3E%3C%2FP%3E%3CP%3ENo%20positive%20result.%20I%20do%20get%20tokens%2C%20but%20the%20errors%20remain.%3C%2FP%3E%3C%2FDIV%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-3021395%22%20slang%3D%22de-DE%22%3E%3CLINGO-LABEL%3EApi%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EDeveloper%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EOnline%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EProject%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Frequent Visitor

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.

0 Replies