Google OAuth-私有IP需要device_id和device_name [英] Google OAuth - device_id and device_name are required for private IP

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

问题描述

我已经看到此页面和其他很多内容,但都提出了不适合我的解决方案.我有与我提供的链接相同的问题.

I have seen this page and plenty others, but all propose solution not suitable for me. I have same problem that the one in link I provided.

我正在尝试使用Google+ API函数,以便用户可以使用Google帐户登录到我的页面.

I am trying to use Google+ API functions, so users can log in to my page with Google account.

当我将redirect_uri重定向到本地主机时:

When I had redirect_uri to localhost:

$client->setRedirectUri("https://localhost/...");

一切正常.但是后来我将其更改为本地IP 192.168.1.10并收到错误消息(网址为

everything worked. But then I changed it to local ip 192.168.1.10 and get error (on url https://accounts.google.com/o/oauth2/auth?response_type=code&redirect_uri=https%3A%2F%2F192.168.1.10.......)

  1. 那是一个错误.

错误:invalid_request

Error: invalid_request

device_id和device_name是专用IP所必需的:

device_id and device_name are required for private IP:

我不知道该怎么办.我使用PHP服务器包装程序.我无法更改etc/hosts,因为我也在移动设备(Android,IPAD)上尝试使用我的代码.因此,本地IP是必需的,以便在Mobile上对其进行测试.我想避免在某些真实服务器上设置测试页,因为在仍然开发页面时,在localhost上测试网页是最快的方法.

I don't know what should I do. I use PHP server wrappers. I can not change etc/hosts because I am also trying my code on mobile (Android, IPAD). So, local IP is necessary, to test it on Mobile. I want to avoid setting up a test page on some real server, because testing web page on localhost is the fastest way, when still developing the page.

推荐答案

如果您无法更改某些设备的主机文件,那么我猜您最好的选择是使用本地DNS服务器来伪造域,就像您一样可以处理/etc/hosts中的条目.这个答案应该可以帮助您:

If you cannot change the hosts file of some of your devices, I guess your best bet is to use a local DNS server to fake a domain, just like you would do with an entry in your /etc/hosts. This answer should help you with this:

https://unix.stackexchange.com/a/64944

如果您将设备设置为使用计算机作为名称服务器,则应该可以欺骗域并将该域用于测试oauth2身份验证.

If you set your devices to use your computer as nameserver it should be possible to spoof a domain and use this domain for testing oauth2 authentication.

以下是有关此错误的更多信息: http://developers.blog.box.com/2012/12/19/going-beyond-oauth2-byod-in-the-enterprise/

Here is some more information about this error: http://developers.blog.box.com/2012/12/19/going-beyond-oauth2-byod-in-the-enterprise/

device_id和devive_name:

device_id and devive_name are mentioned in the specs as well: http://tools.ietf.org/html/draft-ietf-oauth-v2-31#section-3.2.1

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

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