2009-10-05 199 views
8

我正在開發一個使用python-openid的Django應用程序。該應用程序正在我家開發服務器上運行。Google OpenID /聯合登錄定期失敗

與stackoverflow的登錄機制類似,我希望用戶使用他們的Google憑據登錄到我的網站。

我已經實現的代碼能夠很好地工作幾個星期,然後停止工作。我在登錄過程中遇到以下Google頁面:https://www.google.com/accounts/o8/ud,並顯示以下消息:「您請求的頁面無效。」它會再次隨機開始工作,但每隔幾周左右就會失敗。

通過雅虎的登錄去工作了幾個月,到今天已經停止了以下消息的工作:「此頁已過期,回到原來的頁面,請重試」此頁上:https://open.login.yahooapis.com/openid/op/auth

這裏的要求,作爲谷歌被俘的LiveHTTPHeaders:

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 

我不知道這是怎麼回事就在這裏,想和別人一些幫助。

+0

是否一次失敗?一遍又一遍的一天左右?它又開始工作的環境是什麼? – 2009-12-01 22:57:39

+0

我有一個像你一樣的問題。但有些差多少!我在登錄用戶時沒有問題,但每隔一天,由谷歌提供的身份字符串應該是唯一的更改!所以用戶不能再使用他們的賬戶登錄我的網站。我不知道會發生什麼。 – 2010-09-17 19:54:45

回答

0

您可以構建uri並使用GET方法將用戶重定向到uri。如果你在做POST,google會期望一些標題,我認爲它沒有提到文檔。檢查sample請求。我嘗試與GET沒有python-openid它工作得很好。