Search code examples
restjbosskeycloak

Is it possible to commiunicate with jboss/keycloak:16.1.1using REST APIs?


I am requeired to commiunicate with jboss/keycloak:16.1.1 via REST APIs, but i am not sure if this version of keyloak really supports REST APIs !!!

Here is what i have done:

  1. Run the below command to get a running docker container in port 8080 of your machine:

    docker run -p 8080:8080 -e KEYCLOAK_USER=admin -e KEYCLOAK_PASSWORD=admin jboss/keycloak:16.1.1

  2. Open the http://localhost:8080/ and login as admin/admin

  3. Create a new client called admin-rest-client

  4. Setup the authentication configuration as below so that i can get the client's secret: enter image description here

  5. Save the client

Now i should be able to get the Token by calling GET http://localhost:8080/admin/realms/master/protocol/openid-connect/token

and here is what i have tried with postman:

enter image description here

As you see, sadly the response is 404, so i am wondering if REST APIs is supported with jboss/keycloak:16.1.1 ?


I have already successfully commiunicate via REST with quay.io/keycloak/keycloak:23.0 but my here my question is about jboss/keycloak:16.1.1 !!! This docker image is relatively old and the latest images goes back to two years ago!!!


Solution

  • Old versions (under v18 legacy) have extra URL 'auth'

    POST http://localhost:8080/auth/realms/my-realm/protocol/openid-connect/token
    

    New versions (higher v18)

    POST http://localhost:8080/realms/my-realm/protocol/openid-connect/token
    

    enter image description here

    If click here (red box) get the Token URL

    enter image description here

    enter image description here

    enter image description here