Answer the question
In order to leave comments, you need to log in
Angularjs jwt refresh token how to implement?
Actually a question. There is authentication through JWT angularjs.
At the moment, everything works ok, after authorization with api, a token of the form is returned:
eyxxxGciOiJSUzI1NiIsInR5cCI6IkpXUyJ9.eyJleHAiOjE0NDI0MDM3NTgsImVtYWlsIjoid2VibWFzdGVyQGdlc2RpbmV0LmNv........
is written in cookies and works as a header in all requests to api. var token = AuthUser.getToken();
var dateToken = $filter('date')(jwtHelper.getTokenExpirationDate(token), 'dd.MM.yyyy HH:mm:ss');
var dayDate = $filter('date')(new Date(), 'dd.MM.yyyy HH:mm:ss');
if (dayDate > dateToken) {
return $http({
url: API.url + '/api/refresh',
skipAuthorization: true,
method: 'GET',
}).then(function(response) {
var id_token = response.data.token;
AuthUser.setToken(id_token);
return id_token;
});
Answer the question
In order to leave comments, you need to log in
The cookie token is written in the north, so you need to update it there, here is an example: stackoverflow.com/questions/26580213/implementing-...
No additional magic (refresh) is needed on the client
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question