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

OAuth2 c# console application

I am trying to create a console application to download my heartrate data seeing as Fitbit have not deemed it necessary to provide the data in the export data page.

 

Using the Fitbit.net project I can get it to login with OAuth1, unfortunately the heartrate data is not available through an OAuth1 authentication and OAuth2 rather stupidly removes the pin option.

 

I can get the browser to redirect to localhost and get the key from that but have then been unable to add the authentication back into the FitbitClient class.

 

Any help getting this done will be massively appreciated. I really need to have this fully automated so that I can put it into a c# script in SSIS to import my data into my own personal data warehouse.

Best Answer
0 Votes
10 REPLIES 10

Oh yeah, why is the Heart rate data not available on the OAuth1 endpoints? Really bloomin annoying.

Best Answer
0 Votes

Check my comments here:
https://community.fitbit.com/t5/Web-API/How-to-get-started/td-p/904521

The only way to make the developers use the better and newer OAuth2, if they make this decisions. Its a good thin.

Best Answer
0 Votes

Unfortunately I am not a programmer, just a DBA with little knowledge of C#. All I want to do is automatically download my heartrate data, which I could have done had Fitbit allowed it on the OAuth1 endpoint. I don't know how to set up a web api and this would not work inside ssis either. So looks like Fitbit are holding my data to ransom.

Best Answer
0 Votes

@R8VXF wrote:

Fitbit are holding my data to ransom.


This just isn't true.

 

Heart rate and GPS data are restricted to use of OAuth 2.0 because OAuth 1.0a lacked an important feature called "scope". Instead of third-party applications getting access to all of your data, OAuth 2.0 allows people to give granular access. OAuth 2.0 gives people more control of their data, not less.

 


@R8VXF wrote:
Using the Fitbit.net project I can get it to login with OAuth1, unfortunately the heartrate data is not available through an OAuth1 authentication and OAuth2 rather stupidly removes the pin option.

The Implicit Grant Flow is a better end user experience in desktop clients if the clients are capable of receiving an app protocol callback. It makes it so that users don't have to enter anything. It's unfortunate that it may not fit your use case, but it does work much better for most desktop apps.

 


@R8VXF wrote:
I can get the browser to redirect to localhost and get the key from that but have then been unable to add the authentication back into the FitbitClient class.

It sounds like this is actually the source of your problem. Have you opened an issue with the library that you are using?

 

Alternately, could you use a HTTP library instead to make the request for the data and add the "Authorization: Bearer your.token.here" header?

Best Answer
0 Votes
I said held to ransom as you do not provide the ability to download it via the website still. Now I have to teach myself to programme to get at my data.

Currently trying to learn MVC...
Best Answer
0 Votes

@JeremiahFitbit Finally worked out how to make an mvc app display the data and can access the heartrate data, but I have not had a reply to my intraday level access beyond asking for more information about my plans. And that was a week and a half ago.

Best Answer
0 Votes

All sorted with access, and have my WebApp writing to my database. Keep on butting into the rate limiter whilst I get my historical data, but can live with that. Made my first MVC Graph as well to display the data that is returned 🙂

 

HRIntradayRangeSeptember.jpg

 

That is my HR for September 🙂

Best Answer
0 Votes

@R8VXF wrote:

All sorted with access, and have my WebApp writing to my database. Keep on butting into the rate limiter whilst I get my historical data, but can live with that. Made my first MVC Graph as well to display the data that is returned 🙂

 


@R8VXF Any chance you would be willing to share the code for your WebApp?

Best Answer
0 Votes
I can do but it is is just highly bastardised Fitbit.net code from codeplex
Best Answer
0 Votes
Sorry, GitHub.
Best Answer
0 Votes