The token endpoint answers with unsupported_grant_type
unsupported_grant_typeShort answer
unsupported_grant_type means the authorization server did not accept the grant type in your token request. Send a POST to the token endpoint with a body of type application/x-www-form-urlencoded and a grant_type field spelled exactly as the flow needs, such as password. JSON bodies, form-data bodies and GET requests are the usual mistakes.
Fix it fast
1Find out which cause you have
Send the request from a terminal so no client tool changes the headers or the body, and read the full response.
curl -i -X POST https://example.com/token \ -H "Content-Type: application/x-www-form-urlencoded" \ --data-urlencode "grant_type=password" \ --data-urlencode "username=user@example.com" \ --data-urlencode "password=secret"2Match what you see, then jump to its fix
- 1
The same values work from curl with --data-urlencode but fail from Postman raw JSON or form-dataThe body is JSON or multipart form-data, not form-urlencodedFix - 2
error is unsupported_grant_type or invalid_request, and the body has no grant_type or a different spellinggrant_type is missing, misspelled or the wrong value for the flowFix - 3
The token URL works in a browser address bar but returns an error or 405The request uses GET or sends the values in the query stringFix
- 1
What does the error look like?
unsupported_grant_typeinvalid_request
Cause 1 of 3
The body is JSON or multipart form-data, not form-urlencoded
1Check
Token requests carry their parameters in the request body as application/x-www-form-urlencoded. A raw JSON body or a form-data body is not that format, so the server finds no grant_type in it.
curl -i -X POST https://example.com/token -H "Content-Type: application/json" -d '{"grant_type":"password"}'2Fix
In Postman choose Body, then x-www-form-urlencoded, and add the fields as key and value rows. In code, send a form body and set the Content-Type header to application/x-www-form-urlencoded.
curl -i -X POST https://example.com/token \
--data-urlencode "grant_type=password" \
--data-urlencode "username=user@example.com" \
--data-urlencode "password=secret"3Verify
The response is a JSON object with access_token, not an error object.
curl -s -X POST https://example.com/token --data-urlencode "grant_type=password" --data-urlencode "username=user@example.com" --data-urlencode "password=secret"Confirmed by datatracker.ietf.org
Cause 2 of 3
grant_type is missing, misspelled or the wrong value for the flow
1Check
For the resource owner password flow the value must be exactly password, with username and password fields next to it. RFC 6749 defines unsupported_grant_type as a grant type the server does not support, and invalid_request as a request with a missing parameter or a malformed one.
curl -i -X POST https://example.com/token --data-urlencode "grant_type=Password"2Fix
Use the exact value the flow defines and include every required field. If the server never enabled that flow, use the flow it does support instead of retrying the same request.
curl -i -X POST https://example.com/token \
--data-urlencode "grant_type=password" \
--data-urlencode "username=user@example.com" \
--data-urlencode "password=secret"3Verify
The error no longer says unsupported_grant_type.
curl -s -X POST https://example.com/token --data-urlencode "grant_type=password" --data-urlencode "username=user@example.com" --data-urlencode "password=secret"Confirmed by datatracker.ietf.org
Cause 3 of 3
The request uses GET or sends the values in the query string
1Check
RFC 6749 says the client must use the HTTP POST method for access token requests. A GET with parameters in the URL does not follow it.
curl -i "https://example.com/token?grant_type=password"2Fix
Switch the method to POST and move every parameter into the request body.
curl -i -X POST https://example.com/token \
--data-urlencode "grant_type=password" \
--data-urlencode "username=user@example.com" \
--data-urlencode "password=secret"3Verify
The server now returns a token response for valid credentials.
curl -s -o /dev/null -w "%{http_code}\n" -X POST https://example.com/token --data-urlencode "grant_type=password" --data-urlencode "username=user@example.com" --data-urlencode "password=secret"Confirmed by datatracker.ietf.org
How do I stop it coming back?
- Keep one saved token request in your API client with the Body type set to x-www-form-urlencoded.
- Send token requests over HTTPS only, because they carry credentials.
- Prefer an authorization code flow with PKCE for new apps, because the password flow hands user credentials to the client.
Sources
How was this page made?
I drafted this page with AI assistance from the official documents listed under Sources. Every cause above names the document that confirms it. I have not reproduced this fix on a machine of my own yet, so read it as documented guidance, not a test report. Found a mistake? Tell me.
Related fixes
Security
Entra ID token request fails: the request body must contain the parameter 'grant_type'
AADSTS900144: The request body must contain the following parameter: 'grant_type'.
The token endpoint did not find grant_type in the form body of your POST.
3 causes, each with a fixSecurity
Angular HttpClient does not add the X-XSRF-TOKEN header to a request
403 Forbidden on POST, PUT or DELETE while GET works
Angular copies the XSRF-TOKEN cookie into an X-XSRF-TOKEN header only for mutating requests to the same origin, and only when the cookie is readable by script.
5 causes, each with a fixSecurity
An [Authorize] endpoint rejects a request with a bearer token
Authorization Header sent: no Bearer token sent.
An [Authorize] endpoint without a policy name requires an authenticated user.
4 causes, each with a fixSecurity
ASP.NET Core API rejects an Angular user's token: the signature key was not found
401 Unauthorized
The API looked for the key named by the token's kid in the key set it downloaded from your Authority, and the key was not there.
4 causes, each with a fixSecurity
ASP.NET Core rejects the token before checking it: IDX12741, three segments expected
401 Unauthorized
IDX12741 means the string the API pulled out of the Authorization header is not shaped like a JWT: a signed token has three dot-separated parts and an encrypted one has five.
3 causes, each with a fixSecurity
A Microsoft Entra access token shows Invalid Signature when you check it yourself
Tokens that a Microsoft API receives might not always be a JWT that can be decoded
A token issued for Microsoft Graph is not meant for you to validate, so a failed signature check is expected.
2 causes, each with a fix