Auth api refactor