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

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

问题描述

我正在使用[localhost:8080]使用Google Drive API进行开发。突然间,我觉得在我的本地部署沙箱中测试它,并且它的IP地址为[192.168.1.1:8080]。根据这一点我更改了开发者控制台客户端回调URL中的凭据。我正在使用OAuth2WebServerFlow使用用户同意来获取刷新令牌。然后,我将来使用刷新令牌和OAuth2WebServerFlow对用户进行身份验证。但我很惊讶 - 我得到了错误:


  1. 这是一个错误。
    错误:invalid_request
    device_id和device_name是私有IP所必需的:

我不知道什么是发生或我该如何解决它。怎么回事,我不明白 c $ c>文件是使用Magic DNS服务 http://xip.io/ http://nip.io/ (见编辑)


xip.io是一个为任何IP地址提供通配DNS的神奇域名。请说明您的局域网IP地址是10.0.0.1。使用xip.io,

  10.0.0.1.xip.io解析为10.0.0.1 
www.10.0.0.1 .xip.io解析为10.0.0.1
mysite.10.0.0.1.xip.io解析为10.0.0.1
foo.bar.10.0.0.1.xip.io解析为10.0.0.1


使用此服务,您可以指定一个公共视图的域,该域可解析为私人地址。



在控制台中,如果您的重定向URI为(您希望拥有的任何地方):

  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需要在控制台中指定。



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



2016编辑:我听说过xip.io DNS服务器不稳定的报告。有一个复制cat服务 nip.io ,其行为与xip.io完全相同,但2016年7月, nip.io的响应率为100%,而xip .io没有。


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. That’s an error. Error: invalid_request device_id and device_name are required for private IP:

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

解决方案

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 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.

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

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

Replace it with:

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

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

I have no affiliation with xip.io; I'm just a satisfied user.

2016 Edit: 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.

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

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