our context was like: The host was unreachable by any other container inside the cluster.
Since it is unknown how do you build and run your containers or how you’ve automated that process.
Don’t know if you are using docker-compose or you just build them once and not deal at all.
Also don’t know if you are using reverse-proxy traefik or something else.
In our context we just gave a domain to keycloak and added a host parameter to each other container where we needed to access it internally (not externally/over public).
After completing the settlment above this is the API request we perform to keycloak to validate tokens:
Authorization: Bearer token
“name”: “John Doe”,
The official documentation: Keycloak Admin REST API
And you should be aware, based on which part of API you want to consume there are lots of different variations. Some of them like above, require just the realm as parameter to identify what you want to access.
Other requests may require realm and client-id. And if you need to consume Admin REST API, you need to learn to make use of admin-cli client, that would require to perform an authentication request, obtaining a server-side token (storing it on cache/session) and assign it to your future request header params and proceed further.
Often official documentation can be confusing if you’re coming with a background from non-enterprise industry. There is a different mindset on enterprise, when using keycloak api you must break down every relationship as roles/groups and treat them as entire resources.
Additional postman collection example: