question

rohanw-1663 avatar image
0 Votes"
rohanw-1663 asked JamesTran-MSFT edited

Access Denied when making Project Online API call

Hi All,

I'm able to get a access token. But when I try to make an Project Online API call using that token, I get "Access denied you do not have permission to perform this action or access this resource". Kindly let me know if I'm doing something wrong or missing anything or correct way to do it. Here are the details that I'm using for authentication:

  1. Client ID =

  2. Tenant ID =

  3. Client Secret =

  4. Scope = https://graph.microsoft.com/.default

  5. Grant type = client_credentials

  6. Login URl = https://login.microsoftonline.com/{tenant_name}/oauth2/v2.0/token

  7. API Permission58503-image.png




Thanks & Regards,
Rohan

office-sharepoint-onlinesharepoint-dev
image.png (13.2 KiB)
· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @rohanw-1663,

Can I know which endpoint you're calling? Is it Project OData service or Graph endpoint?

Thanks
Baker Kong

0 Votes 0 ·

In addition to @BakerKong-MSFT,
- check the user has necessary roles assigned to perform the API call?
- Also, you can validate the token using https://jwt.ms to see whether you have the necessary permissions/scopes etc.
- Try to repro the same issue by setting exact AAD flow in POSTMAN and see if it works.

0 Votes 0 ·

Hi @BakerKong-MSFT,

I'm using project server endpoint. Here are the details:

Endpoint URL= https://example.sharepoint.com/sites/PWA/_api/ProjectServer/Projects
Method= POST
Parameters= Authorization: Bearer {Access_Token}

Am I missing anything?

Thanks & Regards,
Rohan

0 Votes 0 ·

Hi @rohanw-1663,

Per the endpoint info, it seems that your issue is Project dev issue, which is over our support scope as we only focus on SP/Graph related issue. Hence we'd like to suggest you submit the issue on the Project Community.

Thanks
Baker Kong

0 Votes 0 ·

1 Answer

DM-0365 avatar image
0 Votes"
DM-0365 answered

177654-picture1.png177634-picture2.png177635-picture3.png




You also have to add 2 delegated permissions for Project and PWA directly if you're using MS Project Online and want to access it through an API

We finally figured this out after having to file multiple help requests from 365. Hopefully it will help someone else.


picture1.png (22.9 KiB)
picture2.png (18.3 KiB)
picture3.png (58.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.