[keycloak-user] Problem with keycloak.js

Boettcher, Jim jim.boettcher at hp.com
Mon Jun 2 15:41:28 EDT 2014


We have written an AngularJS client that uses the keycloak.js adapter to get a bearer token and then makes REST calls using the token. The client also stores the token and refresh token to local storage and uses the token from local storage if it is found. This all worked well with the pre-beta1 keycloak.js adapter.
With the beta1 keycloak.js adapter it works the first time we access the page, we get redirected to the login page and get the tokens back. However the client app seems to hang when we use the token found in local storage. After looking at the code it seems that a line might be missing in the function processInit().
Starting at line 58 I made the following code change:
if (initOptions.token || initOptions.refreshToken) {
    setToken(initOptions.token, initOptions.refreshToken);
    initPromise.setSuccess();  //Added this line to get things working

After this change our code started working again.
Can someone take a look at this and advise us if this is correct?

Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20140602/c0c5f6d5/attachment.html 

More information about the keycloak-user mailing list