authentication - How to Get User unique identification upon Gmail login using Zend Framework -


i had implemented oauth google using zend framework. can right user authenticating using gmail id , password , after displaying google docs. how identify user whether old user or new user.

what unique identification google providing after login in our website.

thank you

$consumer = new zend_oauth_consumer($oauthoptions); if (!isset($_session['request_token'])) { $_session['request_token'] = serialize($consumer->getrequesttoken(array('scope' => implode(' ', $scopes)))); $approvalurl = $consumer->getredirecturl(array('hd' => 'default')); echo "<a href=\"$approvalurl\"><h2>login google</h2></a>"; exit(0);}   if (!isset($_session['access_token'])) { if (!empty($_get) && isset($_session['request_token'])) {     $_session['access_token'] = serialize($consumer->getaccesstoken($_get, unserialize($_session['request_token'])));} }} $accesstoken = unserialize($_session['access_token']);unset($_session['request_token']);unset($_session['access_token']); 

you can store returned id google in database , when authenticated (again) search it. id this:

$result = zend_auth::getinstance()->authenticate($adapter);     if ($result->isvalid()) {         $identity = zend_auth::getinstance()->getidentity(); // database query on users table looking $identity. if exists, they're logging in 

Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -