错误:invalid_request device_id 和 device_name 是私有 IP 所必需的 [英] Error: invalid_request device_id and device_name are required for private IP

查看:20
本文介绍了错误:invalid_request device_id 和 device_name 是私有 IP 所必需的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 [localhost:8080] 使用 Google Drive API 进行开发.突然想在本地部署沙箱中测试一下,IP地址为[192.168.1.1:8080].据此,我更改了开发者控制台客户端回调 URL 中的凭据.我正在使用 OAuth2WebServerFlow 通过用户同意来获取刷新令牌.然后在将来我使用刷新令牌和 OAuth2WebServerFlow 来验证用户.但我很惊讶 - 我收到了错误:

I was doing my development with Google Drive API using [localhost:8080]. Suddenly I felt to test it in my local deployment sandbox and it has IP address as [192.168.1.1:8080]. And as per that I changed the credential in developer console client callback URL. I am using OAuth2WebServerFlow to get the refresh token using user consent. Then in future I am using the refresh token and OAuth2WebServerFlow to authenticate the user. But I was surprised - I got the error:

  1. 这是一个错误.错误:invalid_request私有 IP 需要设备 ID 和设备名称:

我不知道发生了什么,也不知道该如何解决.怎么回事,没看懂

I don't know what is happening or how can I fix it. What is going on, I don't understand

推荐答案

编辑 hosts 文件的另一种方法是使用Magic DNS"服务 http://xip.io/http://nip.io/(见编辑)

An alternative to editing a hosts file is to use the "Magic DNS" service http://xip.io/ or http://nip.io/ (see edit)

xip.io 是一个魔法域名,可以为任何 IP 地址提供通配符 DNS.假设您的 LAN IP 地址是 10.0.0.1.使用 xip.io,

xip.io is a magic domain name that provides wildcard DNS for any IP address.Say your LAN IP address is 10.0.0.1. Using xip.io,

        10.0.0.1.xip.io   resolves to   10.0.0.1
    www.10.0.0.1.xip.io   resolves to   10.0.0.1
 mysite.10.0.0.1.xip.io   resolves to   10.0.0.1
foo.bar.10.0.0.1.xip.io   resolves to   10.0.0.1

使用此服务,您可以指定一个解析为私有地址的公共域.

With this service, you can specify a public-looking domain that resolves to a private address.

在控制台中,如果您的重定向 URI 是(无论如何您希望拥有的):

In the Console, if your Redirect URI was (what you wish you had anyways):

http://192.168.1.1:8080/auth/google_oath2/callback

替换为:

http://192.168.1.1.xip.io:8080/auth/google_oath2/callback

重定向 URI"好像不接受通配符,所以需要在控制台指定整个私有ip-xip.io.

"Redirect URIs" does not seem to accept wildcards, so the entire private ip-xip.io needs to be specified in the console.

我与 xip.io 没有任何关系;我只是一个满意的用户.

2016 我听说 xip.io DNS 服务器不稳定的报告.有一个模仿服务 nip.io,其行为与 xip.io 完全相同,但在 2016 年 7 月期间,nip.io 的响应率为 100%,而 xip.io 没有.

2016 I've heard reports of instability with the xip.io DNS servers. There is a copy-cat service nip.io that behaves exactly the same as xip.io, but during July 2016, nip.io had a 100% response rate while xip.io did not.

这篇关于错误:invalid_request device_id 和 device_name 是私有 IP 所必需的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆