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

Access fitbit data of multiple users

ANSWERED

Hi,

I am working on my master's project where I am thinking to create a single platform for multiple devices like jawbone and fitbit. I need to fetch fitbit data of various user's. I am not aware of how can I fetch data of different users provided I have their username and password using fitbit api ? 

 

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Correct: the access token provided by the Authorization Code Grant flow will no longer work after an hour. However, it can be replaced without user intervention. Follow the Refresh Token flow.

View best answer in original post

Best Answer
0 Votes
7 REPLIES 7

You will need to create an application that requests users' permission to access their data, then retrieve their data individually.

 

To get started, register your application at https://dev.fitbit.com/apps and create an OAuth 2 authorization flow to obtain consent from each user. Then use each user's access token to make data requests to the Fitbit Web API.

Best Answer

Thank you Jerem for the quick respone. I will try following the steps you provided. 🙂

Best Answer
0 Votes

Hey Jerem,

I registerd my application and hit the authorization api to authorize my app to fetch the user's data, but when i hit the api it does not respond me with an access token. It shows me a success message but there is no access token. Here is the response i received when i tried hitting through the browser:

"https://fhbjgbiflinjbdggehcddcbncdddomop.chromiumapp.org/oauth2-request?result=success&success="

I am also using POSTMAN as REST client but i am unable to receive the access token.

Could you tell me where I am going wrong ?

 

Best Answer
0 Votes

This is operating correctly at the Fitbit Web API, so the issue must be in your app.

 

Are you using the Authorization Code Grant flow or Implicit Grant flow?

 

The user should be redirected to your app's redirect_uri with a `state` and `code` URL parameter for the Authorization Code Grant flow. The Implicit Grant flow uses a URL fragment (data after the `#` symbol).

Best Answer
0 Votes

Hey Jerem,

I am using application grant flow and I think i made it through. I could successfully generate access token and fetch data. I have 1 question here:

It says the access token is for short time i.e 1 hr. So does it mean, i have to refresh the token every 1 hr to keep fetching the data ?

Best Answer
0 Votes

Correct: the access token provided by the Authorization Code Grant flow will no longer work after an hour. However, it can be replaced without user intervention. Follow the Refresh Token flow.

Best Answer
0 Votes

Hey Vrushankd,

 

Can you share the app you build to access fitbit user data with us ?

 

harsh

Best Answer