Graph API GetPresence returns 403 Forbidden

Amir Sohail 411 Reputation points
2021-12-01T17:42:02.207+00:00

Hi, everyone
I hope you are all feeling well!
I am facing an issue when I call get presence graph API in post-man I have completed some prerequisite e.g
****1) I have registered an app in azure.****

154169-create-azure-app.jpg

****second image****

154119-create-app2jpg.jpg

****2) I have Granted required permissions in graph API like(Presence.Read, Presence.ReadAll).****

154177-permissions.jpg

****3) I have added a secret key to the app.****

154201-secretkey.jpg

****4) I make a call for getting the Bearer token and I got the token successfully.****

154184-barrer-token.jpg

****5) I make calls for getting all users and get all user's data.****

154211-all-users.jpg

****but when I try to call get presence graph API for user status then the response is****

154178-getpresence-response.jpg
{
"error": {
"code": "Forbidden",
"message": "",
"innerError": {
"request-id": "",
"date": "2021-12-01T16:04:25",
"client-request-id": ""
}
}
}

*****Please help me*****

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
10,645 questions
Microsoft Teams Development
Microsoft Teams Development
Microsoft Teams: A Microsoft customizable chat-based workspace.Development: The process of researching, productizing, and refining new or existing technologies.
2,866 questions
{count} votes

Accepted answer
  1. Pierre Audonnet - MSFT 10,166 Reputation points Microsoft Employee
    2021-12-02T04:49:55.187+00:00

    Actually the documentation states that the Application API access aren't supported, it has to be a delegated access. Isn't it the issue? It seems you are making a call as an Application in Postman?

    I tried in Postman with a password grant type (just for the sake of using delegated access) and it does work for me.
    154372-image.png
    154371-image.png

    1 person found this answer helpful.
    0 comments No comments

8 additional answers

Sort by: Most helpful
  1. Pierre Audonnet - MSFT 10,166 Reputation points Microsoft Employee
    2021-12-01T18:12:08.367+00:00

    Your Presence.Read.All is not an Application grant but a Delegated grant. You need to set it as an Application grant if you want to use it the way you do.


  2. Amir Sohail 411 Reputation points
    2021-12-02T05:40:10.533+00:00

    @Pierre Audonnet - MSFT I need your help with how I make calls using grant_type="password".
    Can you share the following screenshot of your call e.g

    1. how you get Bearer token postman
    2. share your header tab may be hidden your id's of the postman
    3. share your authorization of postman

    I will be very thankful for that act of kindness.

    0 comments No comments

  3. Amir Sohail 411 Reputation points
    2021-12-02T06:46:02.997+00:00

    Ohh! Thanks, @Pierre Audonnet - MSFT your answer worked for me thanks a lot again.

    0 comments No comments

  4. Michael Beltoft 1 Reputation point
    2021-12-08T09:04:33.147+00:00

    @Amir Sohail Im having the exact same problem as you.

    How did you solve it with the answer from @Pierre Audonnet - MSFT ?

    Or did you just accept that presence can't be read using azure app but need a manual login?