Hello Shwetha,
Thank you for your reply.
I successfully authenticate the request and get users email/name etc. but not get "Customer Id". This is the user's data as response which I got:
Array
(
[id] => **************
[email] => *****@gmail.com
[verified_email] => 1
[name] => Sachin Kumar
[given_name] => Sachin
[family_name] => Kumar
[link] => https://plus.google.com/**************
[picture] => https://lh4.googleusercontent.com/-CxjPiLZwnPM/AAAAAAAAAAI/AAAAAAAAALI/QMgIXPAnqng/photo.jpg
[gender] => male
[locale] => en
)Here is the code to get this response:
<?php
session_start();
global $objGoogleClient;
global $objGoogleOauth;
require 'login-with-google/config.php';
$objGoogleClient = $gClient;
if(! isset($_REQUEST['code'])){
header('Location: ' . $objGoogleClient->createAuthUrl());
}
if (isset($_REQUEST['code'])) {
$objGoogleClient->authenticate();
$accessToken = $objGoogleClient->getAccessToken();
$_SESSION['token'] = $accessToken;
$_SESSION['googlePlusToken'] = $accessToken;
}
if (isset($_SESSION['token'])) {
$objGoogleClient->setAccessToken($_SESSION['token']);
}
if ($objGoogleClient->getAccessToken()) {
$gpUserData = $google_oauthV2->userinfo->get();
echo '<pre>';
print_r($gpUserData);
die('huuu');
}
Can you plz provide some piece of code or suggestion?
Regards,
Sachin