OAuth refactor