[keycloak-user] updateToken method not working
Dean Peterson
peterson.dean at gmail.com
Thu Oct 30 15:57:51 EDT 2014
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?
keycloak.updateToken().success(function() {
if (data) {
$http({
url: 'http://localhost:8080' + url,
method: method,
data: data,
headers: {
'Content-Type': contentType,
'Accept': acceptType,
'Authorization': 'Bearer ' + service.auth.token
},
transformRequest: angular.identity
}).success(success).error(error);
} else {
$http({
url: 'http://localhost:8080' + url,
method: method,
headers: {
'Content-Type': contentType,
'Accept': acceptType,
'Authorization': 'Bearer ' + service.auth.token
}
}).success(success).error(error);
}
}).error(function() {
alert("Token could not be refreshed!");
location.reload();
});
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/keycloak-user/attachments/20141030/b48a625d/attachment-0001.html
More information about the keycloak-user
mailing list