not able to get access token while mentioning grant type to authorization_code after getting code from authorize url

Manpreet Singh 56 Reputation points
2022-01-25T12:09:12.65+00:00

I did get the code from the authorize url after hitting this url:

https://login.microsoftonline.com/---tenant id -----/oauth2/v2.0/authorize?
client_id=----client id------
&response_type=code
&redirect_uri=----redirect_uri---
&response_mode=query
&scope=user.read

but get error of "invalid_grant" while sending post request to this url:

https://login.microsoftonline.com/---tenant_id----/oauth2/v2.0/token

168284-postman-error.png

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

Accepted answer
  1. Zehui Yao_MSFT 5,846 Reputation points
    2022-01-26T10:56:56.947+00:00

    Hi @Manpreet Singh , please check whether your code parameter is consistent with the content of the response. From my testing, the problem may live here.


    If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.

    1 person found this answer helpful.

0 additional answers

Sort by: Most helpful