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

Getting intraday data from multiple clients with one instance of an application

I am new to Fitbit apps development.  I am new to OAuth2 too.

 

I have written a "personal" desktop app to display my own HR and Steps.  Web API was used, and the app works as expected.

 

Now I want to scale it up to display others' intraday data too, so that it displays intraday data of several people at the same time on an Excel-like user interface.  The app would refresh one cell at a time, to keep it simple.

 

From my experience in building the first app, I believe the Client ID plus the Client Secret (got them when I registered the app) uniquely identifies who I am.  Therefore if I incorrectly enter my Fitbit account and password, the authorization process would terminate.

 

My question is: Now I am trying to get intraday data from more than one Fitbit account, how could I make the app asks for multiple Fitbit account/password entries one by one?

 

Thank you all in advance.

Best Answer
0 Votes
2 REPLIES 2

Hi @Eddy.HK 

 

The client ID and client secret uniquely identify your application with Fitbit.   To collect other people's data, you'll need to provide the authorize URL to the participants so they can complete the authorization flow.  During authorization, they will consent to the scopes or data they want to share with your application.   Once authorization is completed, you will be provided an access token which uniquely identifies the user, the data they agreed to share with your client ID.   You'll need to maintain this access token as long as as you want to retrieve this user's data.   

 

Depending on the authorization flow you use, you may also get a refresh token.  The refresh token is used to obtain a new access token and refresh token when this access token expires.  Once the refresh token is used, it becomes invalid and should be discarded.  You'll need to continue to maintain the access token and refresh tokens to gain access to the participant's data.

 

If you want the user's intraday data, then you'll need to request access at https://dev.fitbit.com/build/reference/web-api/intraday-requests/.

 

 

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google
Best Answer
0 Votes

Thank you Gordon for the prompt reply.  Let me describe a scenario in which my app is designed to work:

 

Suppose it is a soccer training class.  Every participant wears a Fitbit tracker.  At the beginning of the class, the coach starts up my Windows Form app (NOT a Web app) and asks the participants to enter one by one their Fitbit accounts and passwords to the same app on the same computer (there is only one computer, running one instance of the app.)  This should in theory eventually enable the app to access everyone's intraday data. 

 

At the point when the authorize URL leads us to the authorization page, sometimes a Fitbit log-in page is first displayed.  If I log in using the account with which the app has been registered, the scope consent page will come up next correctly.  However, if I enter someone else's account, the authorization process will be terminated.  I learned that I have to get FitBit's approval to access other's intraday data, so I sent a request, and got an email from Fitbit saying that the app associated with my ClientID had been approved.  Then I changed my app from "personal" to "server" (and later tried "client"), but the problem still remains.

 

Please comment.  Thank you,

Best Answer
0 Votes