Skip to content

Undocumented data schema dependency for token for API functions #11

@BarrieP

Description

@BarrieP

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions