Share via

MS Graph returns AuthenticationError for messages endpoint

Ivan Kirinčić 25 Reputation points
2023-10-05T14:35:49.2666667+00:00

Hello,

We are working on an app that interacts with users emails. We have an application with Mail.ReadWrite and User.Read.All permissions. We obtained the JWT token through https://login.microsoftonline.com/TENANT_ID/oauth2/v2.0/token. After that, we call /users and get the response. When we start iterating the users and calling https://graph.microsoft.com/v1.0/users/USER_ID/messages?&count=true.Here we get the following error:
"code": "AuthenticationError",
"message": "Error authenticating with resource",

We double-checked permissions and everything is the same as on the other tenants where it works. Any tips on where and what to look for?

Microsoft Security | Microsoft Graph

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.