What if you use:
Access Denied to Graph (despite valid access token and permissions)
Hi,
I'm getting Access Denied for trying to do a GET request on https://graph.microsoft.com/v1.0/users/${userId}/messages
- I've obtained a valid access token from:
- I've obtained my User ID from
But I cant successfully get my emails from the graph API.
My App's permissions are as follows:
Why is the API still denying my access?
2 answers
Sort by: Most helpful
-
-
Yakun Huang-MSFT 10,555 Reputation points Microsoft External Staff
2025-01-08T02:05:08.62+00:00 Hello josh j,
Thank you for reaching out to Microsoft Support!
After testing, the test results are good, the endpoint is no problem, the test results are as follows:
For your error, please check the following:
1.Try to use
https://graph.microsoft.com/v1.0/me/messages
orhttps://graph.microsoft.com/v1.0/users/ {userPrincipalName}/messages
to list messages2.Try to use common endpoint access token
https://login.microsoftonline.com/common/oauth2/v2.0/token
3.Check whether the token has valid permissions and parse the token in jwt.ms, as shown in the following figure:
4.If you get messages from other users, you need to get authorization from other users
Reference document:
https://learn.microsoft.com/en-us/graph/api/user-list-messages?view=graph-rest-1.0&tabs=http
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.