我從https://github.com/omab/django-social-auth獲得django社交身份驗證並按照其說明操作。如何在Django-social-auth中應用google和yahoo OpenID
我使用google oauth
和yahoo auth
但問題是,它不能獲得first name
和用戶的lastname
,這樣我想用OpenID
在數據庫中保存first name
,last name
,email
,等...但在我無法理解如何實現id的文檔。
我也去了http://openid.net/get-an-openid/也許我可以做一個應用程序,但我找不到如何做到這一點。
我的問題是,我如何在我的django中啓用谷歌和雅虎的OpenID
?
這是我在我的settings.py做過
AUTHENTICATION_BACKENDS = (
'userena.backends.UserenaAuthenticationBackend',
'guardian.backends.ObjectPermissionBackend',
'django.contrib.auth.backends.ModelBackend',
'social_auth.backends.facebook.FacebookBackend',
'social_auth.backends.twitter.TwitterBackend',
'social_auth.backends.google.GoogleOAuthBackend',
'social_auth.backends.google.GoogleOAuth2Backend',
'social_auth.backends.google.GoogleBackend',
'social_auth.backends.yahoo.YahooBackend',
'social_auth.backends.OpenIDBackend'
)
#facebook
FACEBOOK_APP_ID = '45252'
FACEBOOK_API_SECRET = '234324'
FACEBOOK_EXTENDED_PERMISSIONS = ['email']
#twitter
TWITTER_CONSUMER_KEY = '234324'
TWITTER_CONSUMER_SECRET = '234234'
TWITTER_EXTENDED_PERMISSIONS = ['email']
#google
#GOOGLE_OAUTH2_CLIENT_ID = 23423#''
#GOOGLE_OAUTH2_CLIENT_SECRET = '234324'
#GOOGLE_APP_ID = '23432'
#GOOGLE_APP_KEY = '234'
#GOOGLE_SREG_EXTRA_DATA = ''#[('First name', '...')]
#GOOGLE_AX_EXTRA_DATA = ''# [('...', '...')]
#yahoo
#YAHOO_CONSUMER_KEY = '234342'
#YAHOO_CONSUMER_SECRET = '234234'
當我acccess http://127.0.0.1:8000/associate/google/
或http://127.0.0.1:8000/associate/yahoo/
它去雅虎的log.in或谷歌,但它不會登錄我的我的Django項目而當我看到我的數據庫,不創建用戶...
我覺得在使用OpenID
爲google
和yahoo
並不需要KEY
或ID
。所以它不需要app
就像我在facebook
和twitter
中所做的那樣?
我總是在我的日誌得到這個:
Generated checkid_setup request to https://www.google.com/accounts/o8/ud with assocication AMlYA9XiAAnknkW9He8EyJeKuzgFtnhl9YByYurLWutc80ZtG_5XwbOW
[02/Jun/2012 15:00:23] "GET /associate/google/ HTTP/1.1" 200 2390
Error attempting to use stored discovery information: <openid.consumer.consumer.TypeURIMismatch: Required type http://specs.openid.net/auth/2.0/signon not found in ['http://specs.openid.net/auth/2.0/server', 'http://openid.net/srv/ax/1.0', 'http://specs.openid.net/extensions/ui/1.0/mode/popup', 'http://specs.openid.net/extensions/ui/1.0/icon', 'http://specs.openid.net/extensions/pape/1.0'] for endpoint <openid.consumer.discover.OpenIDServiceEndpoint server_url='https://www.google.com/accounts/o8/ud' claimed_id=None local_id=None canonicalID=None used_yadis=True >>
Attempting discovery to verify endpoint
Performing discovery on https://www.google.com/accounts/o8/id?id=AItOawmyGFHvB71i5EXC9I1dyjOKEXxIPJtHRqM
Received id_res response from https://www.google.com/accounts/o8/ud using association AMlYA9XiAAnknkW9He8EyJeKuzgFtnhl9YByYurLWutc80ZtG_5XwbOW
No handlers could be found for logger "SocialAuth"
也有人能幫助我,我怎麼能在我的Django項目申請OpenID
爲google
和yahoo
?
在此先感謝....