开发者

get email using openid and python

I'm trying to get an e-mail address from an OpenId request using the following form below and web.py. I get an OpenId hash back, but I don't see anything related to an e-mail in my apache environment--just a openid_identity_hash.

This is my html form using web.py.

<input type="text" name="openid" value="" style="background: url(http://openid.net/login-bg.gif) no-repeat; padding-left: 开发者_如何学运维18px; background-position: 0 50%%;" />
<input type="hidden" name="return_to" value="${returnUrl}" />
<input type="hidden" name="openid.ns.ext1" value="http://openid.net/srv/ax/1.0" />
<input type="hidden" name="openid.ext1.mode" value="fetch_request" />
<input type="hidden" name="openid.ext1.type.email" value="http://axschema.org/contact/email" />
<input type="hidden" name="openid.ext1.required" value="email" />

Looking at the docs linked off of Google's dev site to OpenID, I've found these attributes to include, which I feel like I'm doing.

openid.ns.ax=http://openid.net/srv/ax/1.0
openid.ax.mode=fetch_request
openid.ax.type.fname=http://example.com/schema/fullname
openid.ax.type.gender=http://example.com/schema/gender
openid.ax.type.fav_dog=http://example.com/schema/favourite_dog
openid.ax.type.fav_movie=http://example.com/schema/favourite_movie
openid.ax.count.fav_movie=3
openid.ax.required=fname,gender
openid.ax.if_available=fav_dog,fav_movie
openid.ax.update_url=http://idconsumer.com/update?transaction_id=a6b5c4

But it never actually asks to approve the e-mail request and I don't see it in my environment. Does web.py just not support it? Can I use something else like authkit to query the e-mail afterwards?


@voodo , Try setting these values.

openid.ns=http://specs.openid.net/auth/2.0&
openid.ns.alias3=http://openid.net/srv/ax/1.0&
openid.alias3.if_available=alias1,alias2,alias3&
openid.alias3.required=alias4&
openid.alias3.mode=fetch_request&
openid.alias3.type.alias1=http://schema.openid.net/namePerson&
openid.alias3.count.alias1=1&
openid.alias3.type.alias2=http://schema.openid.net/contact/email&
openid.alias3.count.alias2=1&
openid.alias3.type.alias3=http://axschema.org/namePerson&
openid.alias3.count.alias3=1&
openid.alias3.type.alias4=http://axschema.org/contact/email&
openid.alias3.count.alias4=1

I am not sure why this works and pure AX schema does not, even though google's XRDS specifies supporting AX schema

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜