fix(oauth): Adding functional oauth tests and fixing oauth bugs