Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/215.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 使用Google Plus API获取用户的圈列表_Javascript_Android_Google Api_Titanium_Google Oauth - Fatal编程技术网

Javascript 使用Google Plus API获取用户的圈列表

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/

我正在使用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/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"
        }