Today, I have an issue getting an Azure AD access token from Postman. This is while it was working before for the same app and other apps I am working on. But none of them are working today.
I was working correctly, but now it shows me this error:
Error: AADSTS900144: The request body must contain the following parameter: ‘client_id’
I use https://login.microsoftonline.com/common/oauth2/v2.0/authorize as auth URL, and https://login.microsoftonline.com/common/v2.0/token for Access token URL.
I have tried these for access token URL but none of them worked. https://login.microsoftonline.com/{{tenant_id}}/v2.0/token
https://login.microsoftonline.com/common/token
https://login.microsoftonline.com/{tenant_id}/token
here is my Azure AD oauth 2.0 configuration. Also, as you see, there is no client_id in the request body.
2
Answers
I found out why it's acting like this: I checked my friend's PC, and it was working there! The issue was the last update of Postman. They have changed something in authorization. just change the Client Authentication to Send client credentials in body and it will work.
I tried to reproduce the same in my environment and got below results
You can get values of auth URL and access token URL from your Azure AD application that varies based on supported account type like below:
Go to Azure Portal -> Azure Active Directory -> App registrations -> Your App -> Overview -> Endpoints
Now I added environment variables in Postman by defining them like below:
Make sure to select the correct Environment while requesting for token with
variables
.I filled the required details same as you to get the access token like below:
When I selected Get New Access Token, I got the
token
successfully as below:I changed
client_id
parameter to blank in variables like below:When I tried to get access token again, I got same error as you like below:
To resolve the error, make sure to pass
client_id
value in right environment and save it.