Giter Club home page Giter Club logo

fitbit-node's People

Contributors

foundling avatar jharris avatar jmdiego avatar lukasolson avatar mbmccormick avatar stephenyeargin avatar twelve17 avatar xxzefgh avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fitbit-node's Issues

calling getRefreshToken throws a 400 error

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}}

Push version to NPM?

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

requestResource not resolving

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?

Listing the default endpoint version = 1.2 is misleading.

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.

Can't get getAccessToken working

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.

Post call does not follow promise catch convention upon error?

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.

Keep running into Fitbit error message "insufficient_permissions"

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?

Deprecated Promise rejection warning

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.

Allow sending body within PUT/POST requests

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.

"Bad Request" for refreshAccessToken

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

refreshAccessToken does nothing

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.

use different callbacks via Authorization flow

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?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.