I just discovered LightOpenID and I think this is great. I managed to get the email address, first and last name and preferred language using the following modification example-gmail.php :
<?php require_once('openid.php'); if (empty($_GET['openid_mode'])) { if (isset($_GET['login'])) { $openid = new LightOpenID(); $openid->identity = 'https://www.google.com/accounts/o8/id'; $openid->required = array('namePerson/first', 'namePerson/last', 'contact/email', 'pref/language'); header('Location: ' . $openid->authUrl()); //header('Location: ' . str_replace('&', '&', $openid->authUrl())); } else { echo '<form action="?login" method="post">' . "\n"; echo '<button>Login with Google</button>' . "\n"; echo '</form>' . "\n"; } } else if ($_GET['openid_mode'] == 'cancel') { echo 'User has canceled authentication!'; } else { $openid = new LightOpenID(); echo 'User ' . ($openid->validate() ? $_GET['openid_identity'] . ' has ' : 'has not ') . 'logged in.'; echo '<pre>'; print_r($openid->getAttributes()); echo '</pre>'; } ?>
I modified the code to make it more readable, the output is:
User https://www.google.com/accounts/o8/id?id=*** has logged in. Array ( [namePerson/first] => Alix [contact/email] => ***@gmail.com [pref/language] => en [namePerson/last] => Axel )
I still canβt get the postal code and other Google users, but I had success with myOpenID.com .
source share