Refactor auth method