Giter VIP home page Giter VIP logo

fitbit-client-oauth2's Issues

Date problem building daily activity summary options

Currently sets the date as :
date: moment().format('YYYY-MM-DD'),

If the user isn't in the same timezone as the server, this will result in the data getting reset to zero at the wrong time ( from the users perspective ).

It seems to work fine just setting :
date: 'today'

Although I've not tested the rollover yet, this would be Fitbit's problem if it goes wrong...

Undocumented data schema dependency for token for API functions

api.js line 29 //TODO: improve this way of getting the token

Being new to a lot of this stuff, this undocumented data schema dependency has had me scratching my head for a bit :)

Might you do the TODO soon?
Or do you have a preferred solution to this?

N.B. this was exposed by your two fitbit projects having incompatible names :

  • This fitbit-client-oauth2 project expects "access_token"
  • The passport-fitbit-oauth2 project saves it as "accessToken"

( Obviously I prefer to use passport, but I also want to use your API functions! )

So a quick and dirty fix for me was to rename where it's saved to suit this project.

from passport-fitbit-oauth2 project example :

var fitbitStrategy = new FitbitStrategy({
clientID: CLIENT_ID,
clientSecret: CLIENT_SECRET,
scope: ['activity','heartrate','location','profile'],
callbackURL: "http://localhost:3000/auth/fitbit/callback"
}, function(accessToken, refreshToken, profile, done) {
// TODO: save accessToken here for later use

done(null, {
    access_token: accessToken, **// MODIFIED was accessToken**
    refreshToken: refreshToken,
    profile: profile
});

});

Then this whole user object can be passed to the API function in this fitbit-client-oauth2 project.

Issue with refreshing tokens?

This could entirely be my own fault, as I think I'm doing something wrong, but after reading through the src/auth.js file I've been implementing my refresh like:

var fitbitTokens = {
                    access_token: user.access_token,
                    refresh_token: user.refresh_token,
                    expires_in: 3600
                };

client.refreshAccessToken(fitbitTokens)
     .then(function (new_token) {
                    // save new_token.access_token
                    // save new_token.refresh_token
                    // save new_token.expires_in
                    // save new_token.expires_at
     }).catch(function(err) {
                    console.log('error refreshing user token', err);
     });

The problem is... it doesn't actually refresh! new_token comes back with the same access_token as before, and that could be as intended but I get a 401 error back from fitbit because the refresh isn't actually successful. Any thoughts?

Is there something else I should be doing with new_token instead of just saving new_token.access_token, new_token.refresh_token, new_token.expires_in, and new_token.expires_at to my db?

"Missing parameters: code"

Hi,

This is the error I'm getting in regards to using your example code. Also, things have also been apparently deprecated. Maybe you can take a look? Thanks.

body-parser deprecated bodyParser: use individual json/urlencoded middlewares auth_server.js:13:9
body-parser deprecated undefined extended: provide extended option ../node_modules/body-parser/index.js:105:29
express deprecated res.send(status, body): Use res.status(status).send(body) instead auth_server.js:38:11

url to fitbit confused

since the update, doing an intraday time series request the api points me to the wrong url:
options:
{ url: 'https://fitbit.com/1/user/-/activities/steps/date/today/today/15min.json',
method: 'GET',
json: true,

] name: 'StatusCodeError', statusCode: 404, message: '404 - \r\n\r\nWas there something else that changed that didn't get pushed into the 2.0.1 release?
"name": "fitbit-client-oauth2",
"version": "2.0.1",
"description": "A fitbit client using OAuth 2.0 authentication.",

thanks for any help

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.