I would like to see the email and the profile name of the user currently logged in and authenticated in my WebApp.
The backend of my app is in PHP and I am currently using the offical google API PHP client library and gets access to the Google Drive account of the user.
In order to get the name i have been trying to go though the userinfo endpoint.
$service = new Google_Service_Drive($client);
echo(serialize($googleOAuth->userinfo->get()->name) . ' ');
However this is not giving me the users email address its currently returning empty.
These are the authorization scopes i have request of the user:
$client->setScopes(Google_Service_Drive::DRIVE);
$client->setScopes(Google_Service_Oauth2::USERINFO_EMAIL);
$client->setScopes(Google_Service_Oauth2::USERINFO_PROFILE);
How do I get the email?
Source: Ask PHP