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