在localhost上使用openid4java开发和测试混合google openid oauth
|
我正在尝试实施混合Google OpenID OAuth协议,以便识别我的用户并访问他们的Google日历数据. 示例请求如下: 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 我已经在谷歌注册了一些域名,并获得了消费者密钥和秘密.但是当我想在localhost上开发和调试我的应用程序时(即openid.return_to = http://localhost:8080/和openid.realm = http://*.mydomain.com和openid.oauth.consumer = www.mydomain.com)并提供我的密钥和secret,openid4java RealmVerifier拒绝这样的身份验证请求. 我甚至试图提供完全有效的选项(我的注册域而不是localhost) – 它似乎正常运行,但重定向消失了(我不想/不能因为缺少技术而在该域中部署应用程序. ). 你能告诉我,如何在localhost上开发这样的应用程序?有没有什么技巧可以测试这样的应用程序? 谢谢你的帮助! 解决方法尝试在开发框中的/ etc / hosts(在linux上)添加指向127.0.0.1的your-machine.your-domain.com,然后将您的应用程序命名为 http://your-machine.your-domain.com(注意:使用您在Google注册的域名替换您的计算机名称和您的域名) (编辑:安卓应用网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
