1

This is the web page which will be redirected to it after logged in:

// get_user_info.php
<?
    $gClient = new \Google_Client();
    $gClient->setApplicationName('Login to Pronexo');
    $gClient->setRedirectUri('http://localhost/pronexo/public/login/login_through_api/');
    $gClient->setClientId('849746924921-ueqhqvtbb6l7ccfrcq4j405bvej03bm7.apps.googleusercontent.com');
    $gClient->setClientSecret('W7DdT0QmATW-3ZVJMO55jsfY');
    $gClient->addScope("https://www.googleapis.com/auth/userinfo.profile");
    $gClient->addScope("https://www.googleapis.com/auth/userinfo.email");
    $oauth2 = new \Google_Service_Oauth2($gClient);
    $userInfo = $oauth2->userinfo;
    echo "<pre>";
    print_r($userInfo);
    die;

The result is like this:

enter image description here

And here is the result of Google_Client {#229 > }

enter image description here

Also I've checked all items of the result but there is no user info. As you know, I have to get the email, name etc of the user who is logged in into my website through google php api. Anyway, any idea how can I access that info?

Martin AJ
  • 6,261
  • 8
  • 53
  • 111

0 Answers0