Fixed login to protect endpoints.