I am trying to get access token with Microsoft graph API. i am keep getting error -
error_description": "AADSTS900144: The request body must contain the following parameter: 'grant_type'
in my post request i added the "grant_type" param, what do i do wrong?
Request: (i put my tenant and edit all the other parameters)
POST https://login.microsoftonline.com/{tenant}/oauth2/v2.0/token HTTP/1.1
Host: login.microsoftonline.com
Content-Type: application/x-www-form-urlencoded
client_id=535fb089-9ff3-47b6-9bfb-4f1264799865
&scope=https%3A%2F%2Fgraph.microsoft.com%2F.default
&client_secret=qWgdYAmab0YSkuL1qKv5bPX
&grant_type=client_credentials
Response:
{
"error": "invalid_request",
"error_description": "AADSTS900144: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: 4c3017cc-8624-4921-8cea-794861ca5a00\r\nCorrelation ID: cf5e682c-7522-4be3-a9f3-16bb33f40946\r\nTimestamp: 2022-08-02 10:20:07Z",
"error_codes": [
900144
],
"timestamp": "2022-08-02 10:20:07Z",
"trace_id": "4c3017cc-8624-4921-8cea-794861ca5a00",
"correlation_id": "cf5e682c-7522-4be3-a9f3-16bb33f40946",
"error_uri": "https://login.microsoftonline.com/error?code=900144"
}
Reference: https://learn.microsoft.com/en-us/graph/auth-v2-service
this worked 4 days ago... i don't know what
thanks!