[keycloak-user] keycloak.js with a different domain (cross domain problems)
Stian Thorgersen
stian at redhat.com
Fri Jun 5 00:47:22 EDT 2015
You need to add web origins to your client to allow CORS requests to Keycloak.
Open the admin console, find your client, in web origins add 'http://unika.localdomain'.
----- Original Message -----
> From: "Juan Diego" <juandiego83 at gmail.com>
> To: keycloak-user at lists.jboss.org
> Sent: Thursday, 4 June, 2015 8:04:19 PM
> Subject: [keycloak-user] keycloak.js with a different domain (cross domain problems)
>
> Hi,
>
> I am getting this error when I try to run this from my apache server instead
> from my app with jboss,
>
> XMLHttpRequest cannot load
> http://unika.localdomain:8080/auth/realms/unika/tokens/access/codes . No
> 'Access-Control-Allow-Origin' header is present on the requested resource.
> Origin ' http://unika.localdomain ' is therefore not allowed access
>
> unica.localdomain is set on my /etc/hosts
>
> Do I have to run my web app on the same server to avoid this?
>
> GET http://localhost:8080/unika/test/undefined/realms/undefined/account 401
> (Unauthorized)
>
>
> Also when I try to run it from as part of my war file on my server
> 12:48:27,159 WARN [org.keycloak.adapters.OAuthRequestAuthenticator] (default
> task-122) No state cookie
> 12:48:56,153 WARN
> [org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint] (default
> task-127) Invoking deprecated endpoint
> http://localhost:8080/auth/realms/unika/tokens/login?client_id=unika-angular&redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Funika%2Ftest%2Fcustomers%2Fview.html&state=48084ae8-d454-4e7e-8c42-01c51ec09a3c&response_type=code
> 12:48:58,570 WARN [org.keycloak.adapters.OAuthRequestAuthenticator] (default
> task-1) No state cookie
>
> And I get a "bad request" on my browser.
>
> My test app is basically the customer-portal-js example with a different
> keycloak.json file
>
>
> I also set in web.xml to secure some folders, and it works fine. So basically
> when I log on to those folders and go back to my web-app it shows the
> correct info.
>
> thanks,
>
> Juan Diego
>
>
>
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
More information about the keycloak-user
mailing list