Tightening of the code around conditional cases of oauth