0
votes

I am usiing the spring boot documentation https://www.baeldung.com/spring-boot-keycloak and i have stopped at POINT 4 i am not able to generate token both by POSTMAN AND curl any suggestion please, especially foe the documentation above. my error is client credentials error.

curl -X POST http://localhost:8080/auth/realms/master/protocol/openid-connect/token -H "Content-Type: application/x-www-form-urlencoded" -d "username=user1" -d "password=Chikodili1" -d "grant_type=password" -d "client_id=login-app"

1

1 Answers

1
votes

This is works for me. I want to point three items, replace -X to -v option and add -d with client_secret. It is got from Keycloak UI at the Client Credential tab and grant_type use with 'client_credentials'

curl -v http://127.0.0.1:8080/auth/realms/Test-realm/protocol/openid-connect/token \
-H "Accept: application/json" \
-d "client_id=RemoteApp" \
-d "client_secret=523b7e5b-3dbd-4f9e-bea1-e9e1d5c62f69" \
-d "grant_type=client_credentials"