I'm trying to add OAuth2 ways to login to my app by following the instructions from their official docs. First step is to get the authorization code, I did it fine. However the next step doesn't work, it always gives me this error:
{
"error": "invalid_request",
"error_description": "AADSTS900144: The request body must contain the following parameter: 'grant_type'.\r\nTrace ID: ff270385-1331-498d-94a1-bcedad81d100\r\nCorrelation ID: d7d7cdd3-2994-4a41-b8b0-7aebca34e81b\r\nTimestamp: 2023-04-22 23:04:06Z",
"error_codes": [
900144
],
"timestamp": "2023-04-22 23:04:06Z",
"trace_id": "ff270385-1331-498d-94a1-bcedad81d100",
"correlation_id": "d7d7cdd3-2994-4a41-b8b0-7aebca34e81b",
"error_uri": "https://login.microsoftonline.com/error?code=900144"
}
It says it lacks the grant_type
on the body, but the instructions said to put those as query params. I put them on a body, same error. I remove everything from query strings and put it all on the body, same error. I put everything on both places, same error.
I looked around and found people telling to add an Content-Type header of application/x-www-form-urlencoded
, doesn't work either. More research and I found someone saying that adding another redirect URI with a trailing / on the Azure app did it for them, didn't do it for me.
At this point I just decided to mess around with the request and I discovered that no matter what I send, it always returns this error. I can give them no query strings, no body and that's the error I get. I send them fake code and ID, same error. My guess is that their error parsing is broken, if the request is wrong that's the error they return you.
What do I do?