Refactoring [rest] and [oauth].