【问题标题】:Invalid parameter value for redirect_uri: Non-public domains not allowed: http://localhost:3000/auth/google/callbackredirect_uri 的参数值无效:不允许使用非公共域:http://localhost:3000/auth/google/callback
【发布时间】:2020-07-03 17:50:19
【问题描述】:
我正在从头开始关注 Traversy Media 最近关于 nodejs 的教程,并像他一样做每一件事,但我不知道为什么我不能使用这个重定向 url http://localhost:3000/auth/google /callback 即使他(教程制作者布拉德·特拉弗斯)可以使用。
【问题讨论】:
标签:
node.js
redirect
localhost
google-oauth
google-authentication
【解决方案1】:
而不是使用
http://localhost:3000/auth/google/callback
我用过
http://127.0.0.1:3000/auth/google/callback
并且在我的 chrome 浏览器中向服务器发出任何请求时也使用了 127.0.0.1。 localhost 不允许被重定向 uri。我在这里找到了允许的 uris 列表(向下滚动半页以找到允许的列表)Link of allowed redirect uris
【解决方案2】:
不确定 Google 是否改变了他们的政策,但截至 2021 年 6 月,像 http://localhost:3000/auth/google/callback 这样的回调 url 正在工作。