zola2 / lightopenid

Automatically exported from code.google.com/p/lightopenid
0 stars 0 forks source link

Consumer (client) side: solution to obtain from Google email, first and last name, country and language #42

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
For those who wants to fetch user data of users using Google openid, here is a 
patch.
(Attached you'll find a diff)

1) Add this function:
    protected function nsTranslate($field)
    {
    switch($field) {
        case "email": return("contact/email");
        case "country": return("contact/country/home");
        case "firstname": return("namePerson/first");
        case "lastname": return("namePerson/last");
        case "language": return("pref/language");
    }
    return($field);
    }
2) In function axParams(), change:
$this->aliases[$alias]='http://axschema.org/'.$field;
to:
$this->aliases[$alias]='http://axschema.org/'.$this->nsTranslate($field);

This should send *FOR GOOGLE* the right openid.ns.ax values in request.
To use it see second attached file

Original issue reported on code.google.com by fili...@grassilli.it on 22 Jun 2011 at 10:06

GoogleCodeExporter commented 8 years ago
And why exactly would this be needed?

I've explained how to get data from Google (and other providers) at 
http://code.google.com/p/lightopenid/wiki/GettingMoreInformation

Is that somehow complicated, or otherwise not understandable?

Original comment by mewp...@gmail.com on 22 Jun 2011 at 10:14

GoogleCodeExporter commented 8 years ago
Sorry, I didn'd find your wiki page: it's very clear :)

Original comment by fili...@grassilli.it on 22 Jun 2011 at 11:16

GoogleCodeExporter commented 8 years ago

Original comment by mewp...@gmail.com on 22 Jun 2011 at 11:17