Keycloak Missing form parameter: grant_type

Borislav Stoilov :

I have keycloak standalone running on my local machine.

I created new realm called 'spring-test', then new client called 'login-app'

According to the rest documentation:

POST: http://localhost:8080/auth/realms/spring-test/protocol/openid-connect/token

{
    "client_id": "login-app",
    "username": "user123",
    "password": "pass123",
    "grant_type": "password"
}

should give me the jwt token but I get bad request with response

{
    "error": "invalid_request",
    "error_description": "Missing form parameter: grant_type"
}

I am assuming that something is missing in my configuration.

EDIT: I was using json body but it should be form url encoded: the following body works:

token_type_hint:access_token&token:{token}&client_id:{client_id}&client_secret:{client_secret}
ipave :

You should send your data in a POST request with Content-Type header value set to application/x-www-form-urlencoded, not json.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=35598&siteId=1