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 Applications API
Microsoft Graph Applications API
A Microsoft API that enables you to manage these resources and actions related to applications in Azure Active Directory.
497 questions
Microsoft Graph Identity API
Microsoft Graph Identity API
A Microsoft API to access Azure Active Directory (Azure AD) resources to enable scenarios like managing administrator (directory) roles, inviting external users to an organization, and, if you are a Cloud Solution Provider (CSP), managing your customer's data.
272 questions
No comments
{count} votes

Accepted answer
  1. Zehui Yao_MSFT 3,791 Reputation points Microsoft Vendor
    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