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

Getting heart rate data, 401 error, OAuth2

ANSWERED

Exception: Request failed for https://api.fitbit.com/1/user/-/activities/heart/date/2015-09-07/1d/1sec/time/00:00/23:59.json returned code 401. Truncated server response: {"errors":[{"errorType":"request","fieldName":"n/a","message":"API client is not authorized to access the resource requested."}]} (use muteHttpExceptions option to examine full response)

 

I am using the script from https://github.com/simonbromberg/googlefitbit and modified to get heart rate data according to the instruction. The code seems to be using Auth 2.0 and I am setting the scope for heartrate. Any idea what I might be doing wrong?

 

Thanks in adv.

Best Answer
0 Votes
2 BEST ANSWERS

Accepted Solutions

From the OAuth 2.0 access token you sent me, I confirmed that the access token did not contain permission for heart rate. You need to request the 'heartrate' scope in the authorization flow. See https://dev.fitbit.com/docs/oauth2/#scope

 

 

View best answer in original post

Best Answer
0 Votes

@JeremiahFitbit wrote:

From the OAuth 2.0 access token you sent me, I confirmed that the access token did not contain permission for heart rate. You need to request the 'heartrate' scope in the authorization flow. See https://dev.fitbit.com/docs/oauth2/#scope

 

 


Thanks for the help. It turned out that I didn't reset/reauthorize after changing the scope etc for the heart rate data. 

View best answer in original post

Best Answer
0 Votes
7 REPLIES 7

Sounds like you're using OAuth 1.0a. Maybe you should open an issue with that project.

Best Answer
0 Votes

@JeremiahFitbit wrote:

Sounds like you're using OAuth 1.0a. Maybe you should open an issue with that project.


Any particular reason you say that? I'm using Google's OAuth2 library (version 17). And from what I can glean from the code, it is making OAuth2.createService() calls to get Fitbit service.

Best Answer
0 Votes

Private message me your OAuth 2 access token and I can tell you if it has the heart rate scope.

Best Answer
0 Votes

From the OAuth 2.0 access token you sent me, I confirmed that the access token did not contain permission for heart rate. You need to request the 'heartrate' scope in the authorization flow. See https://dev.fitbit.com/docs/oauth2/#scope

 

 

Best Answer
0 Votes

@JeremiahFitbit wrote:

From the OAuth 2.0 access token you sent me, I confirmed that the access token did not contain permission for heart rate. You need to request the 'heartrate' scope in the authorization flow. See https://dev.fitbit.com/docs/oauth2/#scope

 

 


Thanks for the help. It turned out that I didn't reset/reauthorize after changing the scope etc for the heart rate data. 

Best Answer
0 Votes

how do I connect OAuth 2.0 ? how to access?

Best Answer
0 Votes

I'd like to get hearrate date from the fitbit

but problem is I can not authorize to get permission from fitbit.

 

How do I use OAuth2.0 ?

 

if possible please let me know about it. have a great day and Thanks and Best wishes

 

-Woong-

Best Answer
0 Votes