oauth refactor