Experiencing a 403 access denied on GET /shares/{shareIdOrEncodedSharingUrl} API

Kanwal Singh 45 Reputation points
2025-04-14T14:18:46.89+00:00

Experiencing a 403 access denied error when attempting to use the GET /shares/{shareIdOrEncodedSharingUrl} API to access a shared driveItem/file, despite being able to open/access the document via the shared link.

According to the documentation here, it specifies the need for Files.ReadWrite permission for the app, which has already been granted.

Currently using a delegated access token with the following scopes:

"scp": "Files.ReadWrite Mail.Read Mail.ReadWrite openid profile User.Read email"

Am I missing out on something?

Best Regards,

Kanwal Singh

Microsoft Security | Microsoft Graph
0 comments No comments
{count} votes

Accepted answer
  1. Saranya Madhu-MSFT 2,375 Reputation points Microsoft External Staff
    2025-04-15T04:38:19.2+00:00

    Hi Kanwal Singh,

    Thanks for reaching out to Microsoft!

    I tried to reproduce the issue on my end and received a success response.

    User's image

    Please ensure your access token is valid and hasn't expired. Also, ensure the scopes in your token match the required permissions. Files.ReadWrite should be sufficient for delegated permissions, but sometimes Sites.ReadWrite.All might be needed and consented in the Azure portal.

    If you are using Application permissions "Files.ReadWrite.All" is required.

    Decode the Token by using jwt.io, scp (scope) or roles: Should include the permissions your app needs, like "Files.ReadWrite.All".

    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.

    1 person found this answer helpful.

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.