Javascript 使用Google Plus API获取用户的圈列表
我正在使用GoogleAOuth,范围如下Javascript 使用Google Plus API获取用户的圈列表,javascript,android,google-api,titanium,google-oauth,Javascript,Android,Google Api,Titanium,Google Oauth,我正在使用GoogleAOuth,范围如下 scope : ['https://www.googleapis.com/auth/tasks', 'https://www.googleapis.com/auth/tasks.readonly', 'https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/
scope : ['https://www.googleapis.com/auth/tasks', 'https://www.googleapis.com/auth/tasks.readonly', 'https://www.googleapis.com/auth/userinfo.profile', 'https://www.googleapis.com/auth/plus.me', 'https://www.googleapis.com/auth/plus.circles.read']
我试图获取有关用户的信息,我使用了以下API
var xhr = Ti.Network.createHTTPClient({
onload : function() {
var data = this.responseText;
var json = JSON.parse(data);
Ti.API.log('json: ' + JSON.stringify(json));
}
});
xhr.open("GET", "https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=" + googleAuth.getAccessToken());
xhr.send();
但它只提供用户的基本信息,我如何才能获得用户圈中朋友的信息
我替换了xhr.open(“GET”https://www.googleapis.com/oauth2/v1/userinfo?alt=json&access_token=“+googleAuth.getAccessToken())代码>带有
xhr.open("GET", "https://www.googleapis.com/plusDomains/v1/people/me/circles?access_token=" + googleAuth.getAccessToken());
控制台中的响应文本如下所示
json: {"error":{"errors":[{"domain":"global","reason":"forbidden","message":"Forbidden"}],"code":403,"message":"Forbidden"}}
我启用了
- Google+API
- 博客API
- 谷歌+网页API
- 谷歌+域名API
与此最接近的API是
尝试测试该系列,看看哪个更适合您的需要。您可以在页面底部测试结果。没有办法找回圆圈的名称
可接受值为:
“已连接”:已验证用户列表中可见的人员列表
也使用请求应用程序的圈。此列表仅限于用户
使其应用程序活动对经过身份验证的用户可见的用户
“可见”:此用户已添加到一个或多个联系人的列表
圆圈,仅限于请求应用程序可见的圆圈
截至2018年8月,Google+API端点
https://www.googleapis.com/plus/v1/people/userId/people/collection
获取所有联系人:https://people.googleapis.com/v1/people/me/connections
。
响应中有一个元数据
键,对于Google+联系人,它看起来有点像这样:
"metadata": {
"sources": [
{
"updateTime": "2013-01-13T19:16:50.668Z",
"etag": "...",
"type": "CONTACT",
"id": "..."
},
{
"etag": "...",
"type": "PROFILE",
"id": "...",
"profileMetadata": {
"userTypes": [
"GOOGLE_USER",
"GPLUS_USER"
],
"objectType": "PERSON"
}
}
],
"objectType": "PERSON"
}
请注意“GPLUS\u用户”
部分 我不认为你能为一个用户得到它。和@DaImTo不一样这里的用户是我,我想拥有我自己的圈子
"metadata": {
"sources": [
{
"updateTime": "2013-01-13T19:16:50.668Z",
"etag": "...",
"type": "CONTACT",
"id": "..."
},
{
"etag": "...",
"type": "PROFILE",
"id": "...",
"profileMetadata": {
"userTypes": [
"GOOGLE_USER",
"GPLUS_USER"
],
"objectType": "PERSON"
}
}
],
"objectType": "PERSON"
}