403 Forbidden error with sites

Calendar Test 21 Reputation points
2022-10-14T21:19:43.097+00:00

Hi, we just created a new app in Azure and we're facing this issue when calling the /sites endpoint..

250695-image.png

We added the Sites.Read.All application permission to the app. We also tested with an app previously created for us for a different purpose and setting that permission gives us a correct response. Both apps have the exactly same configurations, is there any issue related to new apps?

We are generating the token with this API: https://login.microsoftonline.com/{tenant-id}/oauth2/v2.0/token

Microsoft 365 and Office | SharePoint | Development
Microsoft Security | Microsoft Graph
{count} votes

Accepted answer
  1. Shivam Dhiman 6,081 Reputation points
    2022-10-14T22:51:35.04+00:00

    Hi @Calendar Test

    This error generally occurs when you have added delegate permission instead of application in your App. Please make sure if the permission type is application and not delegated. Also check if you have granted Admin Consent after adding "Sites.Read.All" Application permission in your App. Please refer to the below sample screenshot
    250656-permission.png

    After Generating access token, you can decode that token using Jwt.io to check if Application permission is there or not.

    250683-jwt.png

    **NOTE: ** Roles indicate Application permission while scp indicate delegated permission.

    If you are still facing the issue, I would recommend you raise a support case with Microsoft Graph, a Support Engineer will be able to assist you better. You can raise support ticket from
    http://aad.portal.azure.com/ or https://admin.microsoft.com/#/support/requests .

    Hope this helps.

    If the answer is helpful, please click Accept Answer and kindly upvote. If you have any further questions about this answer, please click Comment.

    0 comments No comments

0 additional answers

Sort by: Most helpful

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.