I use slim-jwt-auth on the server side. I don't find a good way to handle token expiration in angular.
My current strategy:
I use a canActivate guard to check the token before accessing a route. Check mean: - check if token is valid (server) - check expiration date with angular2-jwt helpers (client)
If token has a expiration time < 1 day I refresh the token.
Is it possible to start this steps on every http request and not only when accessing routes? For example when the user hanging around on the route a long time?
One method could be a time interval to check. But maybe there are better solutions?