[keycloak-user] Problems when using Javascript Adapter

Bruno Oliveira bruno at abstractj.org
Tue Feb 16 06:49:50 EST 2016


I believe that your issue is related to CORS, take a look at the examples
https://github.com/keycloak/keycloak/tree/master/examples/cors and the
documentation as well
http://keycloak.github.io/docs/userguide/keycloak-server/html/cors.html.


On Tue, Feb 16, 2016 at 9:44 AM LEONARDO NUNES <leo.nunes at gjccorp.com.br>
wrote:

> Hi, I'm having a problem when using the Javascript Adapter with an
> application deployed on Tomcat 7 at localhost:8088 and using Keycloak
> 1.8.0.CR3 on localhost:8080.
>
> I get the following error at the browser console when trying to call
> the keycloak.loadUserProfile() method.
> XMLHttpRequest cannot load http://localhost:8080/auth/realms/demo/account.
> No 'Access-Control-Allow-Origin' header is present on the requested
> resource. Origin 'http://localhost:8088' is therefore not allowed access.
> The response had HTTP status code 403.
>
> And this when I try to call keycloak.loadUserProfile() method.
> XMLHttpRequest cannot load
> http://localhost:8080/auth/realms/demo/protocol/openid-connect/userinfo.
> No 'Access-Control-Allow-Origin' header is present on the requested
> resource. Origin 'http://localhost:8088' is therefore not allowed access.
> The response had HTTP status code 403.
>
> Details:
>
> - If I don't login using keycloak.login() and just navigate to a
> restricted page configured at the web.xml and login, after i'm redirected
> to the restricted page if I try to call keycloak.loadUserProfile() I get
> the same error.
> - If I login using keycloak.login() and then call
> keycloak.loadUserProfile() or keycloak.loadUserProfile() it works.
> - If I navigate to another page and try to call keycloak.loadUserProfile()
> or keycloak.loadUserProfile() I get the same error.
> - It only works right after I login, if I navigate to another page it
> won't work anymore.
>
> This is my keycloak.json file
> {
>   "realm": "demo",
>   "realm-public-key":
> "MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQCrVrCuTtArbgaZzL1hvh0xtL5mc7o0NqPVnYXkLvgcwiC3BjLGw1tGEGoJaXDuSaRllobm53JBhjx33UNv+5z/UMG4kytBWxheNVKnL6GgqlNabMaFfPLPCF8kAgKnsi79NMo+n6KnSY8YeUmec/p2vjO2NjsSAVcWEQMVhJ31LwIDAQAB",
>   "auth-server-url": "http://localhost:8080/auth",
>   "ssl-required": "external",
>   "resource": "accounts-teste",
>   "public-client": true,
>   "enable-cors": true
> }
>
>
> --
> Leonardo Nunes
> ------------------------------
>
>
> *Esta mensagem pode conter informação confidencial e/ou privilegiada. Se
> você não for o destinatário ou a pessoa autorizada a receber esta mensagem,
> não poderá usar, copiar ou divulgar as informações nela contidas ou tomar
> qualquer ação baseada nessas informações. Se você recebeu esta mensagem por
> engano, por favor avise imediatamente o remetente, respondendo o e-mail e
> em seguida apague-o. Agradecemos sua cooperação. This message may contain
> confidential and/or privileged information. If you are not the addressee or
> authorized to receive this for the addressee, you must not use, copy,
> disclose or take any action based on this message or any information
> herein. If you have received this message in error, please advise the
> sender immediately by reply e-mail and delete this message. Thank you for
> your cooperation*
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20160216/b0425863/attachment.html 


More information about the keycloak-user mailing list