Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/34.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
Node.js Google Fitness API只返回{}作为结果_Node.js_Google Api_Google Fit_Google Api Nodejs Client - Fatal编程技术网

Node.js Google Fitness API只返回{}作为结果

Node.js Google Fitness API只返回{}作为结果,node.js,google-api,google-fit,google-api-nodejs-client,Node.js,Google Api,Google Fit,Google Api Nodejs Client,在这里我没有得到任何错误,但我没有得到任何结果从谷歌拟合。我正在尝试为第三个用户获取Google Fit值(example1@gmail.com). 使用者(AuthUser@gmail.com)配置文件正在正确获取,访问令牌有效。但是在尝试获取第三方用户时(example1@gmail.com)和身份验证用户(AuthUser@gmail.com)它只显示{}作为结果的信息。任何人都可以帮我从Google Fit获取健身值 //oauth2Client.js getAccess

在这里我没有得到任何错误,但我没有得到任何结果从谷歌拟合。我正在尝试为第三个用户获取Google Fit值(example1@gmail.com). 使用者(AuthUser@gmail.com)配置文件正在正确获取,访问令牌有效。但是在尝试获取第三方用户时(example1@gmail.com)和身份验证用户(AuthUser@gmail.com)它只显示{}作为结果的信息。任何人都可以帮我从Google Fit获取健身值

    //oauth2Client.js
    getAccessToken(oauth2Client, function() {
      // retrieve user profile
      plus.people.get({ userId: 'me', auth: oauth2Client }, function(err, profile) {
        if (err) {
          console.log('An error occured', err);
          return;
        }
        var token;
        if(oauth2Client.credentials.refresh_token != null){
          token=oauth2Client.credentials.refresh_token;
        }
        else{
          token=oauth2Client.credentials.access_token;
        }
        fit.users.dataSources.list({'userId':'me','token':token,'email':'example1@gmail.com'}, function(err, result) {
          console.log(err);   // it returns only null
          console.log(result); //it returns only {}
        });
        console.log(profile.displayName, ':', profile.tagline);
      });
    });

//fitness.js
          list: function(params, callback) {
            var parameters = {
              options: {
                url: 'https://www.googleapis.com/fitness/v1/users/{userId}/dataSources?access_token={token}',
                method: 'GET'
              },
              params: params,
              requiredParams: ['userId','token'],
              pathParams: ['userId','token'],
              context: self
            };
            return createAPIRequest(parameters, callback);
          },