Refactored and simplified auth service.