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

Use WebAPI get steps of another user, without them needing to re-authenticate every time

ANSWERED

Hello! I am trying to make a Discord bot that will get the step count of a user and post it to a Discord channel. I got it working for me, but I don't know how to make it work for a few other people, as they can't be signed in on the machine I am hosting the bot from.

 

Is this even possible? If so, how would I go about doing it?

Best Answer
0 Votes
1 BEST ANSWER

Accepted Solutions

Hi @me15739 

 

Yes, this can be done using the OAuth functionality.   Follow these generic steps to start collecting data from other Fitbit users

  1. Change the application type in the dev.fitbit.com application settings from "personal" to either "server" or "client"
  2. Post the authorization URL to your sign up screen.  When the user click the URL, they will be presented with the web form asking the user to sign in with their Fitbit account and consent to share their Fitbit data through a list of scopes.
  3. Once they consent, you will be provided with an access token configured for your client ID, the user's Fitbit id and the scopes the user consented to share.
  4. Your application will need to store and keep track of the current access token and refresh tokens.   

Make certain your application is configure with your terms of service and privacy policy describing how you will be collecting their data and using it.  Also, make certain the architecture of your product conforms to the guidelines defined in the Fitbit Platform Terms of Service, https://dev.fitbit.com/legal/platform-terms-of-service/.

 

Let us know if you need more information.

Gordon Crenshaw
Senior Technical Solutions Consultant
Fitbit Partner Engineering & Web API Support | Google

View best answer in original post

Best Answer
0 Votes
6 REPLIES 6

Hi @me15739 

 

Yes, this can be done using the OAuth functionality.   Follow these generic steps to start collecting data from other Fitbit users

  1. Change the application type in the dev.fitbit.com application settings from "personal" to either "server" or "client"
  2. Post the authorization URL to your sign up screen.  When the user click the URL, they will be presented with the web form asking the user to sign in with their Fitbit account and consent to share their Fitbit data through a list of scopes.
  3. Once they consent, you will be provided with an access token configured for your client ID, the user's Fitbit id and the scopes the user consented to share.
  4. Your application will need to store and keep track of the current access token and refresh tokens.   

Make certain your application is configure with your terms of service and privacy policy describing how you will be collecting their data and using it.  Also, make certain the architecture of your product conforms to the guidelines defined in the Fitbit Platform Terms of Service, https://dev.fitbit.com/legal/platform-terms-of-service/.

 

Let us know if you need more information.

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

Yes I have it setup like this, but in testing it seems like they need to be signed in on my host of the python script that gets their step count

Best Answer
0 Votes

For the user to consent, they shouldn't need to be signed onto your host machine where the python script resides.   Would you be able to record a video of the behavior your seeing and send it to me via a private message?

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

I figured it out, my setup isn't going to work 😕

 

Thanks for the help!

Best Answer
0 Votes

Hi @me15739,

 

If you don't mind, would you share your solution here so that other Discord users who encounter the same issue can use your solution as a reference? I'm sure we have several users that are familiar with discord. 

 

Thanks!

Best Answer
0 Votes

I was using the implicit grant flow instead of the authorization one, future users here, make sure you are using the authorization flow

Best Answer