As it is now I have the login session very long (1day), I want to implement the refresh token system for providing a continuity experience.
I was thinking to add for each API a check if the error is 401 then refresh the token if isn't expired and if the refresh is success then recall the API. This solution is very annoying because I have to implement this refresh token for every single API and in some cases is huge (considering components, context callings etc.).
I was thinking to create a listener if something in network fails with 401 to refresh token.
Another solution would be to refresh the token every X time or in case of 401 to redirect to login (I want to avoid because in some cases you work on something and on pressing "save", you will be redirected to login and lose everything)
I'm curious what do you use, have you found something very simple to implement?