trailing spaces and oauth v2.1 fixes