I implemented oAuth Google using the Zend Framework . All I can do right now is authenticate the user using the gmail id and password , after which I show his Google docs. But how to determine the user, whether he is an old user or a new user.
What is the unique identification provided by Google after entering our site.
thank
$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 WITH 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']);
user472521
source
share