I have been trying to follow this page v2-oauth2-auth-code-flow using the Postman collection linked at the start of the page.

I am able to receive an authorization code from the api, but when attempting to get a token I receive the error: "AADSTS900144: The request body must contain the following parameter: 'grant_type'."

Other answers seem to point to this error being causes by either using json instead of urlencoding, or the 'grant_type' parameter being placed in the header instead of the body, but as far I can tell it is correct and placed in the body. I presume that this is formatted correctly since the collection is coming from Microsoft, is there any configuration I need to do in Postman beforehand or something else that seems off?

anonymous user -1104 • Looking at the screenshot, I don't see any problem. Could you please check and confirm the below points:

  • Ideally, when you select x-www-form-urlencoded radio button in the Body section, it automatically sets the Content-Type=x-www-form-urlencoded under the Headers tab. Please make sure that it is added by clicking on hidden headers as highlighted below:
  • If the Content-Type=x-www-form-urlencoded header is not present, you need to add that manually.
  • If it is already there, click on bulk edit under the Body tab and make sure the Keys and Values are colon-separated. Paste the parameters in the notepad and confirm there are no garbage characters.
  • You can also use form-data instead of x-www-form-urlencoded - both works.
  • It must be due to an encoding issue or garbage character.

    After re-installing Postman and deleting my collection, I continued to have the same problem. I then noticed an option within the Configure New Token section of the Authorization tab, inside of the Client Authentication drop-down. Changing the selection from Send as Basic Auth header to Send client credentials in body fixed the issue.