"The API you are requesting could not be found" fitbit-node 包错误
"The API you are requesting could not be found" error with fitbit-node package
我在我的高级项目中使用 FitBit API,但我一直收到 "The API you are requesting could not be found." 错误。我正在使用 fitbit-node 包,这里是导致错误的部分:
router.get('/test', function(req, res) {
if (req.session.authorized) {
client.get('/1/user/-/activities/date/today.json', req.session.access_token).then(function(results) {
res.json(results[0]);
});
} else {
res.status(403);
res.json({
errors: [{
message: 'not authorized'
}]
});
}
});
我正在尝试访问 /1/user/-/activities/date/today.json 端点,但不断出现错误。除了 /profile.json,我无法访问任何其他端点。 req.session.access_token 是来自身份验证的存储访问令牌。我对 /profile.json 使用相同的设置。
我正在关注这个 repo 中的示例,但无法弄清楚为什么它不起作用:https://github.com/lukasolson/fitbit-node/blob/master/example.js
谢谢!
删除路径中的/1/user/-
。它已经在客户端中。
router.get('/test', function(req, res) {
if (req.session.authorized) {
client.get('/activities/date/today.json', req.session.access_token).then(function(results) {
res.json(results[0]);
});
} else {
res.status(403);
res.json({
errors: [{
message: 'not authorized'
}]
});
}
});
我在我的高级项目中使用 FitBit API,但我一直收到 "The API you are requesting could not be found." 错误。我正在使用 fitbit-node 包,这里是导致错误的部分:
router.get('/test', function(req, res) {
if (req.session.authorized) {
client.get('/1/user/-/activities/date/today.json', req.session.access_token).then(function(results) {
res.json(results[0]);
});
} else {
res.status(403);
res.json({
errors: [{
message: 'not authorized'
}]
});
}
});
我正在尝试访问 /1/user/-/activities/date/today.json 端点,但不断出现错误。除了 /profile.json,我无法访问任何其他端点。 req.session.access_token 是来自身份验证的存储访问令牌。我对 /profile.json 使用相同的设置。
我正在关注这个 repo 中的示例,但无法弄清楚为什么它不起作用:https://github.com/lukasolson/fitbit-node/blob/master/example.js
谢谢!
删除路径中的/1/user/-
。它已经在客户端中。
router.get('/test', function(req, res) {
if (req.session.authorized) {
client.get('/activities/date/today.json', req.session.access_token).then(function(results) {
res.json(results[0]);
});
} else {
res.status(403);
res.json({
errors: [{
message: 'not authorized'
}]
});
}
});