angularjsionic-frameworkjwtsatellizer

Angular Satellizer removing JWT from local storage when expired?


I am using Satellizer along with Ionic and Laravel with JWT-Auth for the API.

I am trying to get refreshing tokens working but I think Satellizer is causing me issues.

If I have a token TTL of 5 minutes and log into my app the token is stored correctly. However, when 5 minutes pass and I try to use my app again the token is removed by itself from local storage.

I have searched the Satellizer code but cannot see where this happens, as even if the token has expired I still want to send it in the header so I can resend back a new one.

Any information on this? Thanks.


Solution

  • You are looking for: https://github.com/sahat/satellizer/blob/master/satellizer.js#L375 I suppose

    As far as I can see there seems not to be an easy workaround for this, except for changing package code and doing a pull request. I would suggest adding a config variable to SatellizerConfig like deleteTokenOnExpiration and only delete it if it is set to true, if it is true as default, all tests should pass.