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

Login page and authorize third party api's

Hello 

 

i want to authorize third party api's through fitbit does anyone have idea how we can do this.

 

scenario:

1. in app setting -> login -> browser -> login to application

2. Redirect back to app.

3. get the token and use this for further api calls.

 

Please provide your inputs.

Uber using the same mechanism.  

 

 

Best Answer
0 Votes
6 REPLIES 6

Hi @DBirnale,

 

Are you trying to create an application to integrate with the Fitbit API? If so, I recommend taking a look at our Quick Start guide to first create your application.

 

You'll need to decide how you want your users to authorize your application to collect data from their respective accounts.

 

Once the user gives consent to your application to access their data, you'll receive an access token from which you can begin executing API calls to their account using that token.

 

I hope this helps! Let me know if you have any additional questions.

 

 

Best Answer
0 Votes

I have all basic stuff done. I want my users to login through the login page of my application. And i want to access their data from my application and send it through fitbit app to fetch/send data to my database.

 

Best Answer
0 Votes

@DBirnale It sounds like you need additional information on how to authorize users with the OAuth 2.0 Consent flows.

 

Your users will need to go through the oAuth2.0 authorization flow as outlined in https://dev.fitbit.com/build/reference/web-api/oauth2/

 

  • If you are using the authorization grant flow, the access token you receive has an expiration of 8 hrs and you also receive a refresh token. In order to get a new access token, you will need to use the refresh token.
  • If you are using the implicit grant flow, the access tokens you receive have a max duration of 1 year and you do not get a new refresh token. After the access token expires, the user has to re-authenticate the application again.

Both methods are similar except that with the authorization code grant flow, Fitbit redirects the user back to your application's redirect URL with an authorization code as a URL parameter after user consent. Your application then exchanges the authorization code for an access token and refresh token. Your application stores the access token and refresh token and it will use the access token to make requests to the Fitbit API. It will use the refresh token to obtain a new access token when the access token expires without having to re-prompt the user. 

 

On the other hand, the implicit grant flow will redirect your user back to your application with an access token after consent. Your application stores the access token client-side and use the access token to make requests to the Fitbit API.

 

I hope this helps. Let me know if you need additional information.

 

Best Answer
0 Votes

@JohnFitbit Thanks for the brief description on how we can authorize fitbit api's.

I want more information on how i can authorize my api's.

suppose i have an Api like https://mydomain/Service/api/Transactions/GetLastTransction

 

So how i can authorize this api and get the necessary details to show in fitbit watch. If you can provide an example will be much more helpful.

 

 

Best Answer
0 Votes

@DBirnale I'm still a bit unclear on what you are trying to achieve, but it sounds like you are trying to display other metrics on the device that is not already shown by default (steps, calories, floors, distance, active minutes, and heart rate), or you are trying to display data not tracked by Fitbit, but from another platform, onto the display of your device.

 

So that I can get a better understanding, can you provide me with examples of what data from your API that you are trying to display on your Fitbit watch?

Best Answer
0 Votes

My Api is going to return 

<BGValue>
<BGValue>234</BGValue>
<EntryDate>Aug 22, 2019</EntryDate>
<EntryTime>11:43 AM</EntryTime>
</BGValue>
<CarbsValue>
<CarbsValue>74</CarbsValue>
<EntryDate>Aug 22, 2019</EntryDate>
<EntryTime>11:43 AM</EntryTime>
</CarbsValue>
</ElogEnteriesDTO>
 
This is what i am going to show in the fitbit watch 
But this api is secured so first i want to hit our login api and get the token and with this token i want to hit another api and get the above data.
 
 
Best Answer
0 Votes