angular-poller
angular-poller copied to clipboard
JWT and Restangular instance
Hi,
I'm having some trouble using poller with Restangular instance and JWT authentication. Once user has logged in, Restangular is configured to send Authorization header with a JWT. When the token has expired and user log in once again, default headers sent by restangular are updated. Every api calls i made this way are working fine, but poller instances are still using the same restangular instance with the previous token, even by doing a poller.reset(); after token expiration.
Here is the way i'm providing the promise : poller.get(chatService.getNewMessages(), { action: 'getList', catchError: true, delay: 2000 } );
chatService is my restangular service, and as every services are singletons, I really have no idea why and where an old instance is persisted. Any Idea ?