Java – keyloak missing form parameter: Grant_ type
•
Java
I ran the keycloak standalone program on my local computer
I created a new realm called "spring test" and then a new client named "login app"
According to the remaining documents:
POST: http://localhost:8080/auth/realms/spring-test/protocol/openid-connect/token { "client_id": "login-app","username": "user123","password": "pass123","grant_type": "password" }
I should have been given a JWT token, but I got the wrong request and response
{ "error": "invalid_request","error_description": "Missing form parameter: grant_type" }
I assume that something is missing from my configuration
Editor: I'm using JSON body, but it should be in the form of URL encoding: how the following institutions work:
token_type_hint:access_token&token:{token}&client_id:{client_id}&client_secret:{client_secret}
Solution
You should send data in the post request and set the content type header value to application / x-www-form-urlencoded instead of JSON
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码