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

Is it possible to have a web service in between mobile app & Fitbit API?

Hi,

 

We would like to build a mobile app and a web page for our product that uses the Fitbit API. We decided to create a web service where the web and mobile can interact. We opted to have a web service for the main reason of having to implement our own business logic and a data source to provide for both mobile and web (front-end). Is it possible to implement that? I mean, example would be the user will login through the mobile app using their Fitbit account then sends it to the web service then the web service will send it to the Fitbit server then vice-versa.

Best Answer
0 Votes
2 REPLIES 2

Hi @vandt_puhgeh,

 

Yes, this is a common implementation. The mobile app would open a URL that is your Web app and somehow authenticate the user across your mobile-to-Web app. Then your Web app would start the Fitbit OAuth 2.0 Authorization Code Grant flow. After consent is granted, Fitbit redirects back to your Web app. Your Web app exchanges the code for an access/refresh token. Then your Web app redirects to a nativeapp:// URI to close the consent window.

 

Your mobile app could then requests to your Web app. Your Web app would make the requests to Fitbit's API, process it, and return it to your mobile app. Or both your mobile and Web app could share the Fitbit access token and make requests to the Fitbit Web API from both places (though you'd still need your Web app to refresh the tokens when they expire).

Best Answer
0 Votes

Hi @JeremiahFitbit,

 

Thank you for your reply. We have no current web-page for the app. What we have is a web service. Since you've given the idea of the communication, would it be possible if this is what we do (a little tweak in the process you've given): 

 

1. In the Fitbit web app settings, we indicate the callback URI to be the web service

2. The mobile app calls the Fitbit login to start the OAuth 2.0 Authorization Code Grant Flow.

3. The user consent is granted.

4. The Fitbit redirects to the web service.

5. Web service exchanges the code for access/refresh token

6. After success, the web service calls the nativeapp://?token=<the token>&secret_token=<the secret token>

Best Answer
0 Votes