Refactored authentication
Automatic re-login using token