While get user’s list of followed sites (using application permissions). By calling GET /me/followedSites endpoint gives "access denied”

Anonymous
2024-05-24T05:16:10.9733333+00:00

Hi team,

I was trying to get user’s list of followed sites (using application permissions). But calling GET /me/followedSites endpoint gives "access denied” and not able to know the root cause for this issue. Is this endpoint is not working, is there any other endpoint that i can try to resolve this issue. Please let us know your suggestions on this.

StatusCode:404

StatusCode: Forbidden RawResponseBody: {"error":{"code":"accessDenied","message":"Access denied","innerError":{"date":"2024-05-06T05:03:33","request-id":"85c976e5-6309-462e-a2d5-89ab8c90d24b","client-request-id":"85c976e5-6309-462e-a2d5-89ab8c90d24b"}}}
Thanks
Tanvi Mittal

Microsoft 365 and Office | SharePoint Server | For business
Microsoft 365 and Office | SharePoint | Development
Microsoft 365 and Office | SharePoint | For business | Windows
Microsoft Security | Microsoft Graph
{count} votes

2 answers

Sort by: Most helpful
  1. Anonymous
    2024-05-24T06:31:34.9166667+00:00

    Hi @Tanvi Mittal

    According to the Graph Api, /me endpoints cannot be accessed with application permissions, please use the delegation permissions Sites.Read.All or Sites.ReadWrite.All, See the link below for details:

    https://learn.microsoft.com/en-us/graph/api/sites-list-followed?view=graph-rest-1.0&tabs=http

    Screenshot 2024-05-24 142903

    By the way, using delegation permissions requires the use of auth code flow, for which you can see the link below:

    https://learn.microsoft.com/en-us/entra/identity-platform/v2-oauth2-auth-code-flow

    Hope this helps.

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

    0 comments No comments

  2. RaytheonXie_MSFT 40,496 Reputation points Microsoft External Staff
    2024-05-24T07:02:16.1466667+00:00

    Hi @Tanvi Mittal,

    GET /me/followedSites only support Delegated (work or school account) with at least Sites.Read.All permission. You could refer to the following document

    https://learn.microsoft.com/en-us/graph/api/sites-list-followed?view=graph-rest-1.0&tabs=http#permissions


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

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

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