Fix oauth login regression; add test so it is less likely to reregress