Refactoring AuthAPI.