views:

77

answers:

2

Hi, I'm trying to build a login form using OpenID Auth. I'm using sample code from: http://openidenabled.com/php-openid/ But I only get user's email address when auth with account on myopenid.com I want get returned email when auth link "google.com/accounts/o8/id" How can I do? Thank you very much.

+1  A: 

There's absolutely no guarantee that a particular OpenID will be backed up by an email address.

To get that level of user data, you'll need to look into the "persona" part of the OpenID system

Gareth
Thanks for your help. But I don't understand your answer completely. I think every OpenId must have a correlative email address. What's wrong?
onlyloveone
No, not at all. An OpenID is just a URL. A *Google* account of course has an email address attached to it, but there's no guarantee that [provider X] will use an email address (it might just have a username/password, for example). Even if it does, I might choose to keep it private from sites I'm logging into - that's one of the benefits of OpenID
Gareth
A: 

You must use the AX extension instead of the Simple Registration extension. You also must "require" the email attribute instead of marking it as optional.

Special requirements for Google.

Andrew Arnott
Thanks for your help. The simple code used the SReg class right. I'll try with AX. If I'm not success, I'll ask again :D.
onlyloveone