<div dir="ltr">Thanks, yes the problem was that I added <a href="http://unika.localdomain/">http://unika.localdomain/</a> with a slash at the end, it took me a while to realize the problem<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jun 4, 2015 at 11:47 PM, Stian Thorgersen <span dir="ltr"><<a href="mailto:stian@redhat.com" target="_blank">stian@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You need to add web origins to your client to allow CORS requests to Keycloak.<br>
<br>
Open the admin console, find your client, in web origins add '<a href="http://unika.localdomain" target="_blank">http://unika.localdomain</a>'.<br>
<span class=""><br>
----- Original Message -----<br>
> From: "Juan Diego" <<a href="mailto:juandiego83@gmail.com">juandiego83@gmail.com</a>><br>
> To: <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
> Sent: Thursday, 4 June, 2015 8:04:19 PM<br>
> Subject: [keycloak-user] keycloak.js with a different domain (cross domain problems)<br>
><br>
> Hi,<br>
><br>
> I am getting this error when I try to run this from my apache server instead<br>
> from my app with jboss,<br>
><br>
> XMLHttpRequest cannot load<br>
</span>> <a href="http://unika.localdomain:8080/auth/realms/unika/tokens/access/codes" target="_blank">http://unika.localdomain:8080/auth/realms/unika/tokens/access/codes</a> . No<br>
<span class="">> 'Access-Control-Allow-Origin' header is present on the requested resource.<br>
> Origin ' <a href="http://unika.localdomain" target="_blank">http://unika.localdomain</a> ' is therefore not allowed access<br>
><br>
> unica.localdomain is set on my /etc/hosts<br>
><br>
> Do I have to run my web app on the same server to avoid this?<br>
><br>
> GET <a href="http://localhost:8080/unika/test/undefined/realms/undefined/account" target="_blank">http://localhost:8080/unika/test/undefined/realms/undefined/account</a> 401<br>
> (Unauthorized)<br>
><br>
><br>
> Also when I try to run it from as part of my war file on my server<br>
> 12:48:27,159 WARN [org.keycloak.adapters.OAuthRequestAuthenticator] (default<br>
> task-122) No state cookie<br>
> 12:48:56,153 WARN<br>
> [org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint] (default<br>
> task-127) Invoking deprecated endpoint<br>
> <a href="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" target="_blank">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</a><br>
> 12:48:58,570 WARN [org.keycloak.adapters.OAuthRequestAuthenticator] (default<br>
> task-1) No state cookie<br>
><br>
> And I get a "bad request" on my browser.<br>
><br>
> My test app is basically the customer-portal-js example with a different<br>
> keycloak.json file<br>
><br>
><br>
> I also set in web.xml to secure some folders, and it works fine. So basically<br>
> when I log on to those folders and go back to my web-app it shows the<br>
> correct info.<br>
><br>
> thanks,<br>
><br>
> Juan Diego<br>
><br>
><br>
><br>
><br>
</span>> _______________________________________________<br>
> keycloak-user mailing list<br>
> <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/keycloak-user" target="_blank">https://lists.jboss.org/mailman/listinfo/keycloak-user</a><br>
</blockquote></div><br></div>