[keycloak-user] JS adapter constantly refreshing page

Stan Silvert ssilvert at redhat.com
Tue May 16 08:34:46 EDT 2017


There was a recent bug like this, but it only happened on Chrome.  It's 
fixed in the latest Keycloak release.

Have you tried different browsers?

My advice would be to get the demo running with the same two servers and 
browser version.

https://github.com/keycloak/keycloak/tree/master/examples/demo-template/angular-product-app

Then see if you encounter the same problem.  If so, let us know that our 
demo is broken and we'll try to fix it.

On 5/15/2017 1:02 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



More information about the keycloak-user mailing list