1

https://github.com/omab/django-social-authから django ソーシャル認証を取得し、その指示に従います。

google oauthandを使用していますが、ユーザーのandをyahoo auth取得できないため、、 、 ectをデータベースに保存するために使用したかったのですが、ドキュメントでは id を実装する方法がわかりません.first namelastnameOpenIDfirst namelast nameemail

http://openid.net/get-an-openid/にも行きました。アプリを作成できるかもしれませんが、その方法がわかりません。

私の質問はOpenID、djangoでgoogleとyahooを有効にするにはどうすればよいですか?

これは私が自分の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'

yahooまたはgoogleのlog.inにアクセスhttp://127.0.0.1:8000/associate/google/またはhttp://127.0.0.1:8000/associate/yahoo/移動すると、djangoプロジェクトにログインせず、データベースを見ると、ユーザーが作成されません...

OpenIDforを使用して、 orを必要googleyahooしなかったと思います。だから、私がやったようなことは必要ありません。KEYIDappfacebooktwitter

私はいつもこれをログに記録しました:

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する方法について、誰かが私を助けることができますか?googleyahoo

前もって感謝します ....

4

1 に答える 1

1

OpenID の実装にも問題がありました。SocialAuth は、何の説明もなくエラー ページを表示してくれました。

いくつかの調査の後、問題はパイプラインの設定にあることがわかりました。私の場合、pipeline.py でエラーが発生しました。一部のメソッドにはエラーがありましたが、django は静かで、エラーをログに記録しませんでした。

SOCIAL_AUTH_PIPELINE を単純な値に変更すると、エラーが表示されなくなりました。

SOCIAL_AUTH_PIPELINE = (
    'social_auth.backends.pipeline.social.social_auth_user',
    'social_auth.backends.pipeline.associate.associate_by_email',
    'social_auth.backends.pipeline.misc.save_status_to_session',
    'social_auth.backends.pipeline.user.get_username',
    'social_auth.backends.pipeline.user.create_user',
    'social_auth.backends.pipeline.social.associate_user',
    'social_auth.backends.pipeline.social.load_extra_data',
    'social_auth.backends.pipeline.user.update_user_details',
    'social_auth.backends.pipeline.misc.save_status_to_session',
)

この設定は、SocialAuth の readme から取得されました。

要約すると、認証が機能せず、ログに何も表示されない場合、問題はパイプライン (設定またはメソッド) にある可能性があります。

于 2012-07-28T19:34:33.390 に答える