0👍
I forget to say I deployed this app to google app engine.
After I add localhost:8080 to the "Authorized JavaScript origins" in "APIs & Service" -> Credentials -> "Client ID for Web application", there is no problem now.
But there is one strange thing left: After I delete localhost:8080, the redirect still works fine.
Source:stackexchange.com