authenticating logged in and logged out