lukasolson/fitbit-node

"Bad Request" for refreshAccessToken

Closed this issue · 1 comments

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

Wow the formatting of the code is terrible! Anyways, right after I posted this I dug deeper and found I was getting an
{"name":"Error","status":400,"message":"Bad Request","context":{"errors":[{"errorType":"invalid_grant","message":"Refresh token invalid: <token_here>. Visit https://dev.fitbit.com/docs/oauth2 for more information on the Fitbit Web API authorization process."}],"success":false}}.
So I think I am going to close this issue.