[keycloak-user] keycloak api access

Stian Thorgersen sthorger at redhat.com
Mon Oct 7 02:27:22 EDT 2019


That's not the right approach to get a token for the admin rest api from
CLI.

Take a look at:

https://www.keycloak.org/docs/latest/server_development/index.html#example-using-curl

On Sat, 5 Oct 2019, 13:44 Sankar P, <sankar.curiosity at gmail.com> wrote:

> Hi,
>
> I installed a new keycloak setup using kubernetes, helm charts
>
> helm install codecentric/keycloak
>
>
> Now when I try to login through the web interface, I am able to login to
> the keycloak setup using a `keycloak` user and an auto-generated password
> (say `TsIeWcqrig2YIs`). However, when I repeat the same authenticate
> request using curl, I get the a HTTP 400 with the following error message
> in the keycloak logs:
>
> The curl command that I use is:
>
> ```
> curl -X POST -k -v -d "username=keycloak&password=TsIeWcqrig2YIs"
>
> https://example.com/auth/realms/master/login-actions/authenticate\?session_code\=9arYjZF8fRSe-FFLBfkIsTdgowTHqE8T3NcUmSTTwr8\&execution\=f9e8c53c-4e3f-4450-9d01-a5b42c539f21\&client_id\=security-admin-console\&tab_id\=6d2ztopE4Vc
> ```
>
> I have tried logging in without the url parameters too and get the same
> error. I got these url params from the web client when it logged in via the
> front end. Is there something I am doing wrong ?
>
> The reason why I want to do the API based login, is because, I want to add
> an user and set the password for that user, after my keycloak pod is
> installed. I could not find a reliable way to do this. Any pointers on how
> to do this ?
>
> Thanks.
>
> --
> Sankar P
> http://psankar.blogspot.com
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
>


More information about the keycloak-user mailing list