So to follow up on this, we need another check that if we don't have credentials it changes the loggedIn value as well. 

To test this, login, go to resource->session and delete the credentials and reload the page. I should get a login window.