ジャンゴ&socialauthとOpenIDの認証(openid.ax)をグーグル
-
21-09-2019 - |
質問
私はジャンゴ-socialauthを使用しようとしています( http://github.com/uswaretech/Django- Socialauth の)私のDjangoのプロジェクトのためにユーザを認証するため。
これはOpenIDのでの作業もみの時間であり、私はどのように正確に、このオープンIDの作品を把握しなければなりませんでした。私は今では、多かれ少なかれ、それを理解していますが、私を逃れるいくつかあります。
リクエストはジャンゴ・socialauth.openid_consumer.views.begin中に一緒に入れているとき、認証プロセスが開始されます。私は、発信認証要求が多かれ少なかれ、何かこのようにあることを確認することができます:
https://www.google.com/accounts/o8/ud?openid.assoc_handle=AOQobUckRThPUj3K1byG280Aze-dnfc9Iu6AEYaBwvHE11G0zy8kY8GZ&
openid.ax.if_available=fname&
openid.ax.mode=fetch_request&
openid.ax.required=email&
openid.ax.type.email=http://axschema.org/contact/email&
openid.ax.type.fname=http://example.com/schema/fullname&
openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select&
openid.identity=http://specs.openid.net/auth/2.0/identifier_select&
openid.mode=checkid_setup&openid.ns=http://specs.openid.net/auth/2.0&
openid.ns.ax=http://openid.net/srv/ax/1.0&
openid.ns.sreg=http://openid.net/extensions/sreg/1.1&
openid.realm=http://localhost/&
openid.return_to=http://localhost/social/gmail_login/complete/?janrain_nonce=2010-03-20T11%3A19%3A44ZPZCjNc&openid.sreg.optional=postcode,country,nickname,email
このはここにたくさんの第二の例のようなものです: http://code.google.com/apis/accounts/docs/ OpenID.html#サンプルの
。問題は、要求が、私は戻って取得、code.google.comからの対応する例のようなもの(例えば、応答の第三の例を見ていないこと、であるレスポンスが私が手のdictはこのようなものです。
{
'openid.op_endpoint': 'https://www.google.com/accounts/o8/ud',
'openid.sig': 'QWMa4x4ruMUvSCfLwKV6CZRuo0E=',
'openid.ext1.type.email': 'http://axschema.org/contact/email',
'openid.return_to': 'http://localhost/social/gmail_login/complete/?janrain_nonce=2010-03-20T17%3A54%3A06ZHV4cqh',
'janrain_nonce': '2010-03-20T17:54:06ZHV4cqh',
'openid.response_nonce': '2010-03-20T17:54:06ZdC5mMu9M_6O4pw',
'openid.claimed_id': 'https://www.google.com/accounts/o8/id?id=AItOghawkFz0aNzk91vaQWhD-DxRJo6sS09RwM3SE',
'openid.mode': 'id_res',
'openid.ns.ext1': 'http://openid.net/srv/ax/1.0',
'openid.signed': 'op_endpoint,claimed_id,identity,return_to,response_nonce,assoc_handle,ns.ext1,ext1.mode,ext1.type.email,ext1.value.email',
'openid.ext1.value.email': 'my.emailaddress@gmail.com',
'openid.assoc_handle': 'AOQobUfssTJ2IxRlxrIvU4Xg8HHQKKTEuqwGxvwwuPR5rNvag0elGlYL',
'openid.ns': 'http://specs.openid.net/auth/2.0',
'openid.identity': 'https://www.google.com/accounts/o8/id?id=AItOawkghgfhf1FkvaQWhD-DxRJo6sS09RwMKjASE',
'openid.ext1.mode': 'fetch_response'}
socialauth自体は、私のメールアドレスをこのように受け入れるように構築されています:
elif request.openid and request.openid.ax:
email = request.openid.ax.get('email')
そして、明らかに、これは失敗します。
なぜ私はおそらく、私が何かを間違ってやっているし、私の発信要求が間違っていると、すべてこれは求めていますか?または私がすべて正しくやっているし、新しい方法で情報を受け付けた後、変更をコミットするsocialaouthモジュールを変更する必要がありますか?
アラン
解決
あなたのax.get
に完全な属性URIを使用してみてください、すなわちax.get('http://axschema.org/contact/email')
所属していません StackOverflow