我正在尝试请求通过 Google OAuth 登录的用户的个人资料信息。我的请求格式正确,我成功登录,但是当我尝试在 PHP 中发出以下请求时,我收到错误请求掩码不能为空。有效路径是: ...
但是,从Google People API people.get 文档中可以清楚地看出,请求掩码值是可选的,如果未通过,将返回除 people.connections.list 之外的所有值。这是我的代码:
// The entire OAuth process works up until this point...
// create the service
$service = new Google_Service_People($this->client);
try {
$results = $service->people->get('people/me');
} catch(\Exception $exception) {
echo $exception->getMessage();
exit;
}
这是我从这个错误中得到的异常消息:
{ "error": { "code": 400, "message": "Request mask can not be empty. Valid paths are: [person.addresses, person.age_ranges, person.biographies, person.birthdays, person.bragging_rights, person.cover_photos, person.email_addresses, person.events, person.genders, person.im_clients, person.interests, person.locales, person.memberships, person.metadata, person.names, person.nicknames, person.occupations, person.organizations, person.phone_numbers, person.photos, person.relations, person.relationship_interests, person.relationship_statuses, person.residences, person.skills, person.taglines, person.urls].", "errors": [ { "message": "Request mask can not be empty. Valid paths are: [person.addresses, person.age_ranges, person.biographies, person.birthdays, person.bragging_rights, person.cover_photos, person.email_addresses, person.events, person.genders, person.im_clients, person.interests, person.locales, person.memberships, person.metadata, person.names, person.nicknames, person.occupations, person.organizations, person.phone_numbers, person.photos, person.relations, person.relationship_interests, person.relationship_statuses, person.residences, person.skills, person.taglines, person.urls].", "domain": "global", "reason": "badRequest" } ], "status": "INVALID_ARGUMENT" } }
谁能帮我吗?
更新1:
当我尝试为请求掩码传递一些值时,$service->people->get('people/me', array("person.names"));
我收到异常消息:Illegal string offset 'type'