Use auth tokens to login

Users can choose to stay logged in even after the browser is closed. This is achieved using an authentication token requested from the server that is save in localStorage. When the user logs out, the token is removed from the server. 
before assigning the token, you should check whether there is a value assigned for it in localStorage