<div dir="ltr"><div>I use the following code to make sure I have a valid token before making a request.  Even though I am logged in, if I wait until the token expires then make a request, the error function is called most of the time when I try to update the token using the updateToken method.  I have the page reload, and I have a valid token again.  However, I did not have to log in again because the session had not expired.  I am using 1.1.0-Alpha1-SNAPSHOT   I have read the documentation.  Am I missing something?</div><div><br></div><div>keycloak.updateToken().success(function() {</div><div>        if (data) {</div><div>          $http({</div><div>            url: &#39;<a href="http://localhost:8080">http://localhost:8080</a>&#39; + url,</div><div>            method: method,</div><div>            data: data,</div><div>            headers: {</div><div>              &#39;Content-Type&#39;: contentType,</div><div>              &#39;Accept&#39;: acceptType,</div><div>              &#39;Authorization&#39;: &#39;Bearer &#39; + service.auth.token</div><div>            },</div><div>            transformRequest: angular.identity</div><div>          }).success(success).error(error);</div><div>        } else {</div><div>          $http({</div><div>            url: &#39;<a href="http://localhost:8080">http://localhost:8080</a>&#39; + url,</div><div>            method: method,</div><div>            headers: {</div><div>              &#39;Content-Type&#39;: contentType,</div><div>              &#39;Accept&#39;: acceptType,</div><div>              &#39;Authorization&#39;: &#39;Bearer &#39; + service.auth.token</div><div>            }</div><div>          }).success(success).error(error);</div><div>        }</div><div>      }).error(function() {</div><div>        alert(&quot;Token could not be refreshed!&quot;);</div><div>        location.reload();</div><div>      });</div></div>