Search code examples
keycloakkeycloak-rest-api

Keycloak list all Realms from a SPA


I am implementing an angular App and want to list all existing Realms on the keycloak Server. I configured the realm-management Client Roles of the User Logged in. Now I am able to List all Realms in a Rest-Client (https://keycloakserver/auth/admin/realms) using the login-token of this user, but when I do the same in my SPA I end up in a CORS-Error:

Access to XMLHttpRequest at 'https://keycloakserver/auth/admin/realms' from origin 'https://localhost:9001' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

I know how I can configure CORS Headers for a specific Client, but in my case where do I find the client or is there another way?


Solution

  • Ok I found the solution I had to add a + To the web-Origins.I thought it was enough to have the valid Redirect URL