Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Why am I getting a 401 for heart rate data?

I'm working on a presentation application for a conference monday, and Im getting a 401 not authorized (which is a weird result, shouldn't it be 403?) from the heartrate endpoint.  Help?

 

https://api.fitbit.com/1/user/-/activities/heart/date/today/1d.json

{ statusCode: 401,
  data: '{"errors":[{"errorType":"request","fieldName":"n/a","message":"API client is not authorized to access the resource requested."}]}' }
 
Best Answer
0 Votes
3 REPLIES 3

Are you using OAuth 2.0? Did you ask for heart rate scope?

Best Answer
0 Votes

I'm using your sample code from the twilio demo (with more pieces).

 

Does it only work with OAuth 2.0?  If so, could the docs be updated to indicate that?  Not sure if I have time to update the OAuth to 2.0.

 

K

Best Answer
0 Votes

I'm looking at updating to OAuth2, using the passport-fitbit-oauth2 library, but the example seems incomplete.  It shows how to do the authentication dance, but doesn't show (anywhere) how to make an actual authenticated call.  Passport in 1.0a needed a separate oauth library call to make an authenticated call to a resource.  I've scoured all the usual places and haven't found any examples of how to take the token and make a call out of it using a library.

 

Does anyone have an example of doing this in node?

 

Thanks,

Kirsten

Best Answer
0 Votes