refactoring for oauth post