refactored oauth, added mocking