Reputation: 553
I am trying to get the REST API of keycloak to work.
Thanks to this post I was able to get the token. But when trying the example for the list of users in the first answer, I get the error:
"error": "RESTEASY003210: Could not find resource for full path: http://PATHTOCEAKLOAK:81/auth/user/realms/master/users"
Here my request with Postman:
As I am using a Bitnami-container the admin is called user that's why I am using /auth/user/ instead of /auth/admin/
Upvotes: 35
Views: 66590
Reputation: 1346
For those who are still facing this error and using 17.0+ version of Keycloak, there's a change in endpoints as per the official documentation. I resolved this issue by just using {realm}/user
and omitting /auth
in between.
Upvotes: 108
Reputation: 1
First of all make sure the token you are assigning in the headers is from the admin because its assumed he has all the necessary permissions. Then make the request like this http://localhost:8185/admin/realms/{realm}/users change this "http://localhost:8185" to your domain.
Upvotes: 0
Reputation: 21
Latest for image quay.io/keycloak/keycloak:21.1.1
$docker exec -it container_name bash
Now from the container shell (bash)
bash-5.1$ cd ~/bin/
bash-5.1$./kcadm.sh config credentials --server http://localhost:8080 --realm master --user admin
Enter your credentials for the admin user
bash-5.1$./kcadm.sh update realms/master -s sslRequired=NONE --server http://localhost:8080
Upvotes: 2
Reputation: 301
If you want to know wich url are available on your current realm you can go in Realm -> Settings and click on "Ednpoints" link.
Or directly go to the following url : http://{host}:{port}/realms/{your_realm}/.well-known/openid-configuration.
Upvotes: 6
Reputation: 11
I was actually working on the same and using docker image of bitnami/keycloak:latest
it worked with just removing /auth from base path and keeping it as /admin
something like this (GET http://localhost:8085/admin/realms/test-realm/users)
Upvotes: 1
Reputation: 161
In addition to @Akanksha_p's answer, here is a command to get the token using curl
:
curl -k -H "Content-Type: application/x-www-form-urlencoded" -d "client_id=your-client" -d "username=some-user" -d "password=hardpassword" -d "grant_type=password" -X POST https://your.fqdn.server:8443/realms/yourrealm/protocol/openid-connect/token
Upvotes: 16