(refactor) fixed remaining OAuth functions for SQL