I have registered an application in Azure AD. I selected supported account type as 'Single-tenant'. I have given permissions like user.read, openid and profile.
Now, I am trying to get access token from Postman. I have given parameters like below:
https://login.microsoftonline.com/mytenantid/oauth2/v2.0/token
client_id='myapp client id'
&scope=https://graph.microsoft.com/user.read
&redirect_uri=http://localhost
&grant_type=authorization_code
&client_secret='myapp client secret'
I am getting the below error:
AADSTS900144: The request body must contain the following parameter: 'code'.\r\nTrace ID: ffa4ba48-3287-4615-b6a3-aa71ed757400\r\nCorrelation ID: b375f781-2486-40d4-adee-826b9dc440ec\r\nTimestamp: 2022-04-21 12:13:10Z",
I am not understanding what code to give and how to find code value. Can anyone help me out?
Thanks in advance.
CodePudding user response:
To resolve the error, you have to include code parameter in Postman.
To get that value, try to form an authorize url like below:
Copy that code value and add that parameter in postman.
Please Note that, the code value will work only one time. To get the code value again, you have to repeat the above process again.
I tried in my environment, after adding the code parameter, I got the access token successfully:
For more in detail, please refer below link: