Manoj
Manoj

Reputation: 1

Microsoft Graph GetChat API returns forbidden error for some chats

The GetChat API (https://graph.microsoft.com/v1.0/chats/{chatid}) from Microsoft Graph returns error 403 (Forbidden) for some chats when using application permissions. The application being used has Chat.Read.All permissions with admin consent granted. Also, the same application returns success for other chats.

Following are errors for couple of requests to get chat, that were tried using Postman:

1:

{
    "error": {
        "code": "Forbidden",
        "message": "Forbidden",
        "innerError": {
            "date": "2021-10-18T13:16:26",
            "request-id": "79c2ca6f-5b85-44ed-a3da-ef3607630a41",
            "client-request-id": "79c2ca6f-5b85-44ed-a3da-ef3607630a41"
        }
    }
}

2:

{
    "error": {
        "code": "Forbidden",
        "message": "Forbidden",
        "innerError": {
            "date": "2021-10-18T13:18:37",
            "request-id": "5cfd4f22-8c25-4ecf-aa88-0c0c3df560d4",
            "client-request-id": "5cfd4f22-8c25-4ecf-aa88-0c0c3df560d4"
        }
    }
}

Upvotes: 0

Views: 658

Answers (1)

Shweta
Shweta

Reputation: 351

You could try couple of things here -

  1. Try the same API call in Graph explorer and observe if you still see this error. This will help in identifying if there is any issue with the token that you have generated.
  2. You may have changed your API permissions after giving your application admin consent. When you give admin consent, Azure AD will take a "snapshot" of the permissions at the time of consent. Then if you change the permissions later, you will need to re-do the admin consent process again.
  3. Personal accounts are not supported. Refer permissions here.

Upvotes: 0

Related Questions