Token authorization with login and logout
Refactor and remove function