[keycloak-user] keycloak.js library, init callback never called?

David Delbecq david_delbecq at trimble.com
Thu Feb 9 18:33:58 EST 2017


Hello,

I have a strange issue with the keycloak.js library. I have this code

      var loader = $q.defer();
      var keycloakAuth = new Keycloak(keycloakConfig);
      var keycloakInit = ......
      keycloakAuth.init(keycloakInit).success(function (authenticated) {
          auth.loggedIn = authenticated;
          if (authenticated){
            KeycloakStorage.setStatus(keycloakAuth);
          }
          auth.authz = keycloakAuth;
          loader.resolve('loaded');
      }).error(function () {
        loader.reject('Failed to load keycloak settings');
          });

The init is in check-sso mode and include the refresh and access token last
saved in borwser storage.

However, when there is some keycloak misconfiguration (here CORS value were
bad in client config of keycloak), the iframe generates a 404 without any
log event in keycloak, and on javascript side, neither the success nor the
error callback get called. I had the feeling, reading the doc, that i
should have the guarantee that either error or success will be called. Am i
understanding the documentation wrong or is it a bug in Keycloak.js ?

Best regards.
-- 
<http://www.trimble.com/>
David Delbecq
Software engineer, Transport & Logistics
Geldenaaksebaan 329, 1st floor | 3001 Leuven
+32 16 391 121 <+32%2016%20391%20121> Direct
david.delbecq at trimbletl.com
<http://www.trimbletl.com/>


More information about the keycloak-user mailing list