Fix redirect flow of oauth