我正在尝试实现混合谷歌OpenID + OAuth协议,以便识别我的用户并访问他们的谷歌日历数据。
示例请求如下所示:
https://www.google.com/accounts/o8/id
?openid.ns=http://specs.openid.net/auth/2.0
&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select
&openid.identity=http://specs.openid.net/auth/2.0/identifier_select
&openid.return_to=http://www.example.com/checkauth
&openid.realm=http://www.example.com
&openid.assoc_handle=ABSmpf6DNMw
&openid.mode=checkid_setup
&openid.ns.oauth=http://specs.openid.net/extensions/oauth/1.0
&openid.oauth.consumer=www.example.com
&openid.oauth.scope=http://docs.google.com/feeds/+http://spreadsheets.google.com/feeds/我正在使用openid4java。我试着关注这篇文章:library-to-integrate-googles-oauth-openid-hybrid-in-java-web-app
但是当我在localhost上测试我的应用程序时遇到了麻烦。
正如您在前面提到的示例请求中看到的,有三个属性必须相等:
openid.realm
openid.oauth.consumer
openid.return_to我已经在谷歌注册了一些域名,并获得了消费者密钥和秘密。但是,当我想要在本地主机(即openid.return_to=http://localhost:8080/、openid.realm=http://*.mydomain.com和openid.oauth.consumer=www.mydomain.com)上开发和调试我的应用程序并提供我的密钥和密钥时,openid4java RealmVerifier拒绝这样的身份验证请求。
我甚至尝试提供完全有效的选项(我的注册域,而不是localhost) -它似乎可以工作,但重定向消失了(我不想/不能在该域中部署应用程序,因为缺少技术)。
您能建议一下,如何在本地主机上开发这样的应用程序吗?如何测试这样的应用程序有什么诀窍吗?
谢谢你的帮助!
发布于 2011-03-15 06:45:22
尝试添加您的-machine.your-domain.com,它指向您的dev机器上/etc/hosts (在linux上)中的127.0.0.1,然后将您的应用程序设置为http://your-machine.your-domain.com
(注意:将您的- machine替换为您的机器名称,将您的- domain替换为您在Google注册的域名)
https://stackoverflow.com/questions/5283864
复制相似问题