Automatically log out a user when their session expires and fix sign-out, because it causes a google login infinite loop.