Using Postman I'm accessing the keycloak API method for reasoning to avoid the key cloak page as login page in my angular application. I'm getting access_token from belonging to the master realm but while accessing the other realm (created for specific to the angular application) with token as the Authorization Bearer Token my request, getting 404 not found error.
Note: If I add any junk value append in token It says that 401 unauthorized
Screenshot from Postman:


There should be a base path /auth/admin/realms/ when using their RESTful API. The /admin/realms part was missing from the base path stated in their documents.
/auth/realms/master/protocol/openid-connect/tokenKEYCLOAK_TOKEN=$(curl -X POST "${KEYCLOAK_URL}/auth/realms/master/protocol/openid-connect/token" \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "username=admin" \
-d "password=admin-password" \
-d 'grant_type=password' \
-d 'client_id=admin-cli' | jq -r '.access_token')
curl "${KEYCLOAK_URL}/auth/admin/realms/${KEYCLOAK_REALM}/users" -H "Authorization: Bearer ${KEYCLOAK_TOKEN}"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With