Auth factory refactoring