Google OpenID /联合登录定期失败

时间:2009-10-05 19:17:33

标签: django openid

我正在开发一个使用python-openid的Django应用程序。该应用程序正在我家的开发服务器上运行。

与stackoverflow的登录机制类似,我希望用户使用他们的Google凭据登录我的网站。

我已经实现了这样做的代码,可以运行几周,然后停止工作。我在以下Google页面的登录过程中遇到了问题:https://www.google.com/accounts/o8/ud并显示以下消息:“您请求的页面无效。”它将随机重新开始工作,但每隔几周就会失败一次。

通过雅虎的登录工作了几个月,今天已停止使用以下消息:“此页面已过期,请返回原始页面,请在此页面上重试”https://open.login.yahooapis.com/openid/op/auth

以下是LiveHttpHeaders for Google捕获的请求:

https://www.google.com/accounts/o8/ud

POST /accounts/o8/ud HTTP/1.1
Host: www.google.com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.0.10) Gecko/2009042513 Ubuntu/8.04 (hardy) Firefox/3.0.10
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8    
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://127.0.0.1:8000/users/login/
Content-Length:907
openid.ax.if_available=ext1&openid.mode=checkid_setup&openid.ns=http://specs.openid.net/auth/2.0&openid.realm=http://127.0.0.1:8000/accounts/login/&openid.return_to=http://127.0.0.1:8000/users/login/finish/?janrain_nonce=2009-10-05T19%3A10%3A11ZtioiRm&openid.ax.count.ext1=unlimited&openid.ax.mode=fetch_request&openid.sreg.optional=email&openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&openid.ns.sreg=http://openid.net/extensions/sreg/1.1&openid.ns.ax=http://openid.net/srv/ax/1.0&openid.identity=http://specs.openid.net/auth/2.0/identifier_select&openid.assoc_handle=AOQobUcnzec0bpeZRztjqPrr5TQUA0aPL7SIuOPOMgWxex2HRAP09AyJ&openid.ax.required=ext0&openid.ax.type.ext0=http://schema.openid.net/namePerson&openid.ax.type.ext1=http://schema.openid.net/contact/web/default

HTTP/1.x 400 Bad Request
Cache-Control: no-cache, no-store, max-age=0, must-revalidate

我不确定这里发生了什么,并希望得到一些帮助。

3 个答案:

答案 0 :(得分:0)

看起来您正在使用的代码生成了错误的URL请求。真实网址为https://www.google.com/accounts/o8/id,因此请尝试修改“ud”,最后将其更改为“id”。

希望这有帮助!

答案 1 :(得分:0)

您可以构建uri并使用GET方法将用户重定向到uri。如果你做POST谷歌期望一些标题,我认为它没有提到文档。检查sample请求。我尝试使用GET而不使用python-openid它运行得很好。

答案 2 :(得分:0)

您可以查看内部的redirect_uristate来查看它们是否匹配。我记得有时在state上与Google登录名不匹配的问题。

如果您使用的是Django,我建议您使用social-app-django,它目前处于活动状态,并且支持多种社交登录选项(如果您有时考虑添加更多社交登录提供程序)。

相关问题