lukasolson / fitbit-node Goto Github PK
View Code? Open in Web Editor NEWAn API client library for Fitbit, written in NodeJS.
License: MIT License
An API client library for Fitbit, written in NodeJS.
License: MIT License
Whenever the user wants to revoke the access, how do we do that?
I see the revoke access is a POST operation with body parameter.
Would you please change the Fitbit API version called to 1.2 in fitbit-api-client.js on line 181 like so:
function getUrl(path, userId) {
return path = 'https://api.fitbit.com/1.2/user/' + (userId || '-') + path;
}
Fully backward compatible (except 409 error-codes maybe?). Otherwise this keeps coming up :-). Or better still: an optional version-parameter?
Thank you, Harald
What do you think about this change?
https://github.com/sarkestudio/fitbit-node/blob/master/fitbit-api-client.js#L26-L31
I can make a PR if it makes sense.
Hello,
Thanks for making this package. It took me a little while to figure out how to use it because NPM seems to have a pretty different version than what is represented here.
Have you considered pushing this version to NPM? I'm pulling directly from this repo now, so it is working.
I am new to coding / node.js so forgive me if this is niave.
Thanks,
Abe
When I call the refreshAccesstoken method with a valid refreshToken:
client.refreshAccesstoken(req.body.refreshToken).then(function (result) {
console.log("BACK FROM REFRESHACCESSTOKEN" + JSON.stringify(result));
}).catch(function (error) {
console.error('problems getting refresh token: ' + JSON.stringify(error));
res.send(error);
});
I see the following error:
problems getting refresh token: {"name":"Error","status":400,"message":"Bad Request","context":{"errors":[{"errorType":"invalid_request","message":"Missing parameters: refresh_token Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."}],"success":false}}
UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): TypeError: Cannot read property 'req' of undefined
(node:39861) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
Currently, it's not possible to send a body when performing a PUT/POST request using the requestResource
function. This is something that the Fitbit API needs for some requests.
Hi, I believe this is something that could be improved upon:
2017-09-16T04:34:47.760Z 5ed2f788-9a98-11e7-9724-fd7f1e43e31c CDC-REMOVE: Result of fitbit.post: [
{
"errors": [
{
"errorType": "insufficient_permissions",
"message": "API client is not authorized by the resource owner to access the resource requested. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."
}
],
"success": false
}
,
{
"statusCode": 403,
"body": {
"errors": [
{
"errorType": "insufficient_permissions",
"message": "API client is not authorized by the resource owner to access the resource requested. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."
}
],
"success": false
},
// etc
}
]
You're returning errors as a resolved promise, not a rejected one.
Hello! Question, not an issue... I'm kinda a noob at this, but I've followed the demo example, and I've got it working! :)
I will always have to call /authorize
first, is that correct?
Will I always be restricted to the single URL Callback as specified in the Fitbit API Setup screen?
In the example.js demo, /callback
is executed just fine... it gets profile info.... But, what if I wanted to add another route, say /GetTXCFile
?
I guess I'm trying to think of a way where I could have a couple of different routes:
/heartrate
/steps
/getGPSfiles
My ultimate goal though is bulk-downloading the TCX files. I have all the file names, I just don't want to manually download them 1 by 1. So... I'm sure I can create a loop, and use Node's "path" tool... but would you have any ideas on how to capture the XML response, and save it to a file?
Hi, thanks for the module. I'm having issues getting the requestResource method to resolve it's promise. It just seems to hang without any feedback? Rate limit hit?
lol
By stating in the instructions the default API version = 1.2, people will make the assumption version 1.2 applies to all endpoints. As of today, Sleep is the only set of endpoints that support version 1.2. Most of the other endpoints support version 1. Using the incorrect version could generate unwanted errors. Please correct the code and instructions, or add a note to verify the version in the documentation.
Is redirectURL is mandatory for getAccessToken(code, redirectUrl) function ? because we are doing Authorize from Mobile APP and getting tokens in backend (NODE JS).
Fitbit is phasing OAuth 1, https://dev.fitbit.com/docs/oauth2/
Perhaps I don't understand how and where this package should work. I try to access my Heart Rate Intraday Time Series with client.get("/activities/heart/date/today/1d/1sec/time/00:00/23:59.json", result.access_token)
...
But keep getting this error. (After changing example.js and accessing http://localhost:3000/authorize
{"errors":[{"errorType":"insufficient_permissions","message":"API client is not authorized by Fitbit to access the resource requested. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."}],"success":false}
I registered a Fitbit app of type Personal. Accessing /profile.json works. Also I tried fitbit-node in my browser but I get a CORS error there. This is to be expected and unavoidable, right?
What could cause this "insufficient_permissions" error?
The version on NPM is still on 2.1.0 : https://www.npmjs.com/package/fitbit-node
When I attempt to print results from the promise, or even just print a "Hello," there's nothing. I'm passing in the access token and refresh token as strings, and the expiration in seconds as an integer. There are no errors being reported during runtime. Oddly enough, getAccessToken works perfectly fine.
I have received authorization through getAuthorizateUrl but after getAccessToken I get this error on the console. Where should I start looking for a solution?
XMLHttpRequest cannot load https://api.fitbit.com/oauth2/token. Response to preflight request doesn't pass access control check: The value of the 'Access-Control-Allow-Credentials' header in the response is '' which must be 'true' when the request's credentials mode is 'include'. Origin 'http://localhost:3000' is therefore not allowed access. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.
Hello,
I am getting a bad request error when trying to call client.refreshAccessToken in the code below. It never gets inside the ".then(function(result) {" block:
var client = new FitbitApiClient(FITBIT_CONSUMER_KEY, FITBIT_CONSUMER_SECRET); return client.refreshAccessToken(accessToken, refreshToken, expiresInSeconds).then(function(result) { console.log("result: " + JSON.stringify(result)); user.accessToken = result.access_token; user.refreshToken = result.refresh_token; return user; }); }) .then(function(user){ console.log("save user object"); saveInPromise(user); }) .done(function(){ console.log("refreshAccessToken() end"); }); }
Have you seen this error before? I'm using version 2.0.5. Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.