Token undefined
Hi - does this code still work correctly?
I am getting:
TypeError: Cannot read property 'oauth_token_secret' of undefined at /Users/simon/code/node/node_modules/fitbit-js/example/test.js:24:39 at callbacks (/Users/simon/code/node/node_modules/express/lib/router/index.js:161:37) at param (/Users/simon/code/node/node_modules/express/lib/router/index.js:135:11) at pass (/Users/simon/code/node/node_modules/express/lib/router/index.js:142:5) at Router._dispatch (/Users/simon/code/node/node_modules/express/lib/router/index.js:170:5) at Object.router (/Users/simon/code/node/node_modules/express/lib/router/index.js:33:10) at next (/Users/simon/code/node/node_modules/express/node_modules/connect/lib/proto.js:199:15) at Object.expressInit as handle at next (/Users/simon/code/node/node_modules/express/node_modules/connect/lib/proto.js:199:15) at Object.query as handle
The callback: fitbitClient.getAccessToken(req, res, function (error, newToken) { console.log('never get here, but sure we should'); if(newToken) { token = newToken; res.writeHead(200, {'Content-Type':'text/html'}); res.end('Now get stuff'); } }); doesn't seem to get called, which looks like the problem to me.
Any ideas?
is there anything returned in the first parameter (the error params)?
Hi, I am receiving the exact same error. Have you been able to solve it?
When you first started up the test app, did you navigate straight to /getStuff? That would definitely result in that error since there isn't a token yet. There should probably be a redirect to / if token is undefined.
No, when I start up the test app, I navigate to /. However, the callback: fitbitClient.getAccessToken(req, res, function (error, newToken) { console.log('never get here, but sure we should'); if(newToken) { token = newToken; res.writeHead(200, {'Content-Type':'text/html'}); res.end('Now get stuff'); } }); doesn't seem to get called
After you get redirected back from fitbit.com, where do you end up?
If I put callback as /getStuff, then I end up at /getStuff with the error "TypeError: Cannot read property 'oauth_token_secret' of undefined." Since I am never getting to the callback of fitbitClient.getAccessToken(...
If I leave callback blank I get redirected to a fitbit page with "You have successfully authorized access to [app], Please return to [app] and enter the following PIN when requested: 9oetrufr52c1het7d0l1v8693j." However, my app is a browser app in dev.fitbit.com.
Any ideas?
the callback needs to be /
When the callback is set to / I get stuck in a loop on the Fitibit site giving the application access.
@ryanburgess are you still seeing this issue? (also, see #14)