"AADSTS900144: The request body must contain the following parameter: 'grant_type'.?
Asked Answered
G

4

7

I built an app in my Azure ad b2c tenant and configured it as shown, but why can't I request an access token in postman?

app registration

API permissions

postman screenshot

Here are the links to the two documents I follow:

Register a Microsoft Graph application

Get access without a user

Guinna answered 6/8, 2020 at 5:48 Comment(0)
A
14

One thing I noticed is that the parameters for the token request should be in the body as form parameters, like this:

Parameters in Body tab of Postman with x-www-form-urlencoded selected

You should use the parameters you've defined here though, this screenshot shows a test request for the ROPC flow so the parameters in the picture are not valid for your use case.

So instead of entering the parameters in Params, enter them in Body tab after selecting x-www-form-urlencoded as the type.

Auric answered 6/8, 2020 at 5:53 Comment(0)
P
4

Please input the params in "Body" tab of your postman but not "Params" tab. Shown as below screenshot.

enter image description here

Psychodiagnosis answered 6/8, 2020 at 5:57 Comment(0)
F
1

In order to get token you need to pass grant_type in request body and value should be password.

For example

Method Post: https://login.microsoftonline.com/YourTenantID/oauth2/v2.0/token

And in body you need to ppass client_id : Your app client ID scope: user.read%20openid%20profile%20offline_access username: Your username password: your password grant_type: password client_secret: you app registration secret

Flip answered 6/8, 2020 at 5:58 Comment(0)
W
0

I tried many times to put into body with JSON format or in parameter or put into Parameters, but I did not work. And it works for me when I put into Body with type is x-www-form-urlendcoded. [Image]: https://i.sstatic.net/tguZc.png

Wanderoo answered 7/7, 2022 at 3:33 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Register

© 2022 - 2024 — McMap. All rights reserved.