I'm currently working with Google_Client api and want to fetch User Name, Phone, Email and User address.
I set-up these scope
'https://www.googleapis.com/auth/plus.login',
'https://www.googleapis.com/auth/user.birthday.read',
'https://www.googleapis.com/auth/user.addresses.read',
'https://www.googleapis.com/auth/user.emails.read',
'https://www.googleapis.com/auth/user.phonenumbers.read'
And When Click on the login with google it asking correct permission and then i fetch the access token with code. After getting the token i request for people_service and profile data like this.
$token = $this->client->fetchAccessTokenWithAuthCode($_GET['code']);
$people_service = new \Google_Service_PeopleService($this->client);
$profile = $people_service->people->get(
'people/me',
array('personFields' => 'addresses,birthdays,emailAddresses,phoneNumbers')
);
It give me Google_Service_PeopleService_Person Object back. But when i any method on it like getPhoneNumbers() it give Call to undefined method Google_Service_PeopleService_Person::getNamesg() Error.
What is the problem and what can i do now ??
from How to get data form Google_Service_PeopleService?
No comments:
Post a Comment