Oct 24 2023 03:40 AM
Hi all,
I am currently trying to access the data found in Project Online via a Python script. I am able to get the access token but when I try to make a get statement with the access token in the header, I only get unauthorized errors.
I keep getting the error: Error: 401 - {"error_description":"Exception of type 'Microsoft.IdentityModel.Tokens.AudienceUriValidationFailedException' was thrown."}
When I google the problem, I get the answer saying that my Graph API is not correctly configured. However, when I try to search for other methods, I get the message that Graph API does not support Project Online. I am pretty confused at this stage whether this is even possible.
Any help would be greatly appreciated
My Python Code:
Oct 24 2023 11:44 AM
SolutionHello @OliverWalter ,
The Graph API does not include any endpoints for Project Online, you need to call these directly from the PWA site. What you can do though is auth to the Project Online Reporting API via an Azure AD app- see the post here from Brian - it shows you the Azure AD app - the rest of the post is for ADF so that wont be relevant: https://techcommunity.microsoft.com/t5/project-support-blog/reading-project-online-odata-with-azure-...
Paul
Oct 25 2023 07:37 AM
@Paul Mather Thanks for the quick response!
I went through the response from Brian but I am still confused as to why my code does not work. I took all the steps In the app registration I gave myself all the necessary permissions. I also get the access token so it has to be something to do with the 'get' request that I am doing wrong...
Oct 26 2023 03:20 AM - edited Oct 26 2023 03:21 AM
Hello @OliverWalter ,
For the Project Online Reporting API, it doesn't support app only auth, you need to pass in a valid user too (username + password), it's user + app auth. The user account used will need a license in PWA and also access to the Reporting API. Maybe it's that?
Paul