<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">&lt;<a href="mailto:stian@redhat.com" target="_blank">stian@redhat.com</a>&gt;</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 &#39;<a href="http://unika.localdomain" target="_blank">http://unika.localdomain</a>&#39;.<br>
<span class=""><br>
----- Original Message -----<br>
&gt; From: &quot;Juan Diego&quot; &lt;<a href="mailto:juandiego83@gmail.com">juandiego83@gmail.com</a>&gt;<br>
&gt; To: <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
&gt; Sent: Thursday, 4 June, 2015 8:04:19 PM<br>
&gt; Subject: [keycloak-user] keycloak.js with a different domain (cross domain    problems)<br>
&gt;<br>
&gt; Hi,<br>
&gt;<br>
&gt; I am getting this error when I try to run this from my apache server instead<br>
&gt; from my app with jboss,<br>
&gt;<br>
&gt; XMLHttpRequest cannot load<br>
</span>&gt; <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="">&gt; &#39;Access-Control-Allow-Origin&#39; header is present on the requested resource.<br>
&gt; Origin &#39; <a href="http://unika.localdomain" target="_blank">http://unika.localdomain</a> &#39; is therefore not allowed access<br>
&gt;<br>
&gt; unica.localdomain is set on my /etc/hosts<br>
&gt;<br>
&gt; Do I have to run my web app on the same server to avoid this?<br>
&gt;<br>
&gt; 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>
&gt; (Unauthorized)<br>
&gt;<br>
&gt;<br>
&gt; Also when I try to run it from as part of my war file on my server<br>
&gt; 12:48:27,159 WARN [org.keycloak.adapters.OAuthRequestAuthenticator] (default<br>
&gt; task-122) No state cookie<br>
&gt; 12:48:56,153 WARN<br>
&gt; [org.keycloak.protocol.oidc.endpoints.AuthorizationEndpoint] (default<br>
&gt; task-127) Invoking deprecated endpoint<br>
&gt; <a href="http://localhost:8080/auth/realms/unika/tokens/login?client_id=unika-angular&amp;redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Funika%2Ftest%2Fcustomers%2Fview.html&amp;state=48084ae8-d454-4e7e-8c42-01c51ec09a3c&amp;response_type=code" target="_blank">http://localhost:8080/auth/realms/unika/tokens/login?client_id=unika-angular&amp;redirect_uri=http%3A%2F%2Flocalhost%3A8080%2Funika%2Ftest%2Fcustomers%2Fview.html&amp;state=48084ae8-d454-4e7e-8c42-01c51ec09a3c&amp;response_type=code</a><br>
&gt; 12:48:58,570 WARN [org.keycloak.adapters.OAuthRequestAuthenticator] (default<br>
&gt; task-1) No state cookie<br>
&gt;<br>
&gt; And I get a &quot;bad request&quot; on my browser.<br>
&gt;<br>
&gt; My test app is basically the customer-portal-js example with a different<br>
&gt; keycloak.json file<br>
&gt;<br>
&gt;<br>
&gt; I also set in web.xml to secure some folders, and it works fine. So basically<br>
&gt; when I log on to those folders and go back to my web-app it shows the<br>
&gt; correct info.<br>
&gt;<br>
&gt; thanks,<br>
&gt;<br>
&gt; Juan Diego<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
</span>&gt; _______________________________________________<br>
&gt; keycloak-user mailing list<br>
&gt; <a href="mailto:keycloak-user@lists.jboss.org">keycloak-user@lists.jboss.org</a><br>
&gt; <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>