[keycloak-user] JS adapter constantly refreshing page
Abhishek Koserwal
akoserwa at redhat.com
Fri Dec 15 10:52:29 EST 2017
You need update your client configuration in keycloak for
Web Origins : +
I tested with your given code snippet.
Thanks,
Abhishek
On Mon, May 15, 2017 at 10:32 PM, <sesnor.silva at sapo.pt> wrote:
> Hello,
>
> I'm trying to integrate keycloak's JS adapater into an application.
> However for some reason the page keeps refreshing (every 5 seconds or
> so?) after successfully logging in.
>
> I managed to reproduce the problem with the following minimal code:
>
> <!-- index.html FILE -->
> <!DOCTYPE html>
> <html>
> <head>
> <title></title>
> </head>
> <body>
>
> <script type="text/javascript"
> src="https://ajax.googleapis.com/ajax/libs/angularjs/1.6.4/angular.min.js
> "></script>
> <script type="text/javascript" src="<MY KEYCLOAK
> SERVER>/auth/js/keycloak.js"></script>
> <script type="text/javascript">
> angular.element(document).ready(function() {
> var keycloakAuth = Keycloak('keycloak.json');
>
> keycloakAuth.init({
> onLoad: 'login-required'
> }).success(function(authenticated) {
> keycloakAuth.loadUserInfo().success(function (userInfo) {
> console.log(userInfo)
> });
> }).error(function() {
> var error = "There was an error initializing the
> authentication module.";
> console.error(error);
> });
> });
> </script>
> </body>
> </html>
>
> I tried searching around but I didn't find too many answers. I tried
> to base my implementation around:
> https://github.com/bandrzejczak/keycloak-angular-
> akka-http/blob/master/client/app.js
> and
> https://github.com/keycloak/keycloak/tree/master/examples/
> demo-template/angular-product-app
>
> But I get the same behavior every time: The page just keeps refreshing.
>
> It seems to be related to blocking third-party cookies on the
> browser. I use Firefox 53. Since my Keycloak isn't on the same host
> as the application, I think the browser rejects the keycloak's
> cookies. If this is the case, what could be a workaround for this? Is
> there any option on the adapter's side? I'm worried some browser might
> block third-party cookies by default (Opera and Brave Browser come to
> mind).
>
> Thank you,
> My best regards,
> Silva
>
> _______________________________________________
> keycloak-user mailing list
> keycloak-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/keycloak-user
--
Regards,
Abhishek Koserwal
Software Application Engineer, ADS
Red Hat (Pune, India)
IRC: akoserwa
The capacity to learn is a gift; The ability to learn is a skill; The
willingness to learn is a choice -- Brian Herbert
More information about the keycloak-user
mailing list