Microsoft Graph API - Mail

Mathew P Thomas 41 Reputation points
2021-09-30T18:52:27.343+00:00

Hi Team,

I m using MS Graph API to call Mail API. I am able to get the token via postman by calling
https://login.microsoftonline.com/42a02713-284f-41e7-ba44-65bb7c8950cf/oauth2/v2.0/token

I use the token from above api to call :
https://graph.microsoft.com/v1.0/me/messages/

I get the below error:

"error": {
"code": "BadRequest",
"message": "/me request is only valid with delegated authentication flow.",
"innerError": {
"date": "2021-09-30T18:50:40",
"request-id": "f4431d06-9434e-4f1d-9434-43a763256a3b",
"client-request-id": "1e3c1d06-943f-4f1d-94334-44a7633276a3b"
}
}
}

Microsoft Graph
Microsoft Graph
A Microsoft programmability model that exposes REST APIs and client libraries to access data on Microsoft 365 services.
11,431 questions
{count} votes

Accepted answer
  1. CarlZhao-MSFT 40,236 Reputation points
    2021-10-01T01:31:26.95+00:00

    The error should be caused by you using the client credential flow. You are calling the /me endpoint, so you should use the delegated authentication flow with user login to obtain the token. For example, auth code flow or ROPC flow.


    If an Answer is helpful, please click "Accept Answer" and upvote it.

    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.

    2 people found this answer helpful.

2 additional answers

Sort by: Most helpful
  1. Kat Hopkins 1 Reputation point
    2022-01-12T00:55:24.607+00:00

    Hi, Matthew, can you please write up what you did to get it working? I am trying to do something similar from flow to call Calendars.Read and get the same error you initially had. ANy help would be appreciated


  2. Kat Hopkins 1 Reputation point
    2022-01-12T02:35:18.583+00:00

    Thank you for that, I will see if that is what is going on with my flow.

    0 comments No comments