Google Oauth2.0 网络应用程序的 "Authorized redirect URIs" 必须以 public 顶级域(例如 .com 或 .org)结尾?
Google Oauth2.0 web application's "Authorized redirect URIs" must end with a public top-level domain (such as .com or .org)?
在 Google Developers Console 上创建 Google API Oauth2.0 凭据时,我选择 "Web Application" 应用程序类型。
在 "Authorized redirect URIs" 字段中,我可以使用 http://127.0.0.1/callback,它对我来说在本地开发中工作得很好。
但是当我想在我的服务器上使用 Google API Oauth2.0 凭据时(比如说 99.99.99.99),我必须使用 http://99.99.99.99/callback 作为我的 "Authorized redirect URIs",但是 google 给我一个警告:
Invalid Redirect: http://99.99.99.99/callback must end with a public
top-level domain (such as .com or .org)
除了绑定public顶级域名到我的服务器,我还能做什么?
我在Django开发,用oauth2client来处理GoogleAPIOauth2,所以有两个table"oauth2_authentication_credential","oauth2_authentication_flowmodel" 在我的数据库中有凭证值,我将它们从我的本地主机复制到服务器,但它不起作用。
"Authorized redirect URIs" 字段附近有帮助文本,明确指出您不能使用 public IP 地址:
Authorized redirect URIs
For use with requests from a web server. This
is the path in your application that users are redirected to after
they have authenticated with Google. The path will be appended with
the authorization code for access. Must have a protocol. Cannot
contain URL fragments or relative paths. Cannot be a public IP
address.
127.0.0.1
不是 public IP,而是 loopback, that's why http://127.0.0.1/callback works fine. localhost also could be used: http://localhost/callback
Except to bind a public top-level domain to my server, what else can I do?
您可以通过http://xip.io/. So for IP 99.99.99.99
use http://99.99.99.99.xip.io/callback. And it would be resolved to http://99.99.99.99/callback使用免费的DNS。
在 Google Developers Console 上创建 Google API Oauth2.0 凭据时,我选择 "Web Application" 应用程序类型。
在 "Authorized redirect URIs" 字段中,我可以使用 http://127.0.0.1/callback,它对我来说在本地开发中工作得很好。
但是当我想在我的服务器上使用 Google API Oauth2.0 凭据时(比如说 99.99.99.99),我必须使用 http://99.99.99.99/callback 作为我的 "Authorized redirect URIs",但是 google 给我一个警告:
Invalid Redirect: http://99.99.99.99/callback must end with a public top-level domain (such as .com or .org)
除了绑定public顶级域名到我的服务器,我还能做什么?
我在Django开发,用oauth2client来处理GoogleAPIOauth2,所以有两个table"oauth2_authentication_credential","oauth2_authentication_flowmodel" 在我的数据库中有凭证值,我将它们从我的本地主机复制到服务器,但它不起作用。
"Authorized redirect URIs" 字段附近有帮助文本,明确指出您不能使用 public IP 地址:
Authorized redirect URIs
For use with requests from a web server. This is the path in your application that users are redirected to after they have authenticated with Google. The path will be appended with the authorization code for access. Must have a protocol. Cannot contain URL fragments or relative paths. Cannot be a public IP address.
127.0.0.1
不是 public IP,而是 loopback, that's why http://127.0.0.1/callback works fine. localhost also could be used: http://localhost/callback
Except to bind a public top-level domain to my server, what else can I do?
您可以通过http://xip.io/. So for IP 99.99.99.99
use http://99.99.99.99.xip.io/callback. And it would be resolved to http://99.99.99.99/callback使用免费的DNS。