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

Ruby on Rails Fitgem heart rate

He Fitbit users, 

 

I have a question about the usage of the Fitgem.
Currently i've integrated oauth 2.0 in my application so Fitbit users can sign in via that. Now the problem i'm getting is that when i want to show the users her heart rate it shows as 0. Ive synched my fitbit etc. 

 

The code i'm using in my application to get the data from the user:

 

def show
  render json: get_user_activities(current_user)
end

private
def get_user_activities(fitbit_data)
  fitbit_user_id = fitbit_data.uid
  user_secret = fitbit_data.secret
  user_token = fitbit_data.token

  client = Fitgem::Client.new({
    consumer_key:'#',
    consumer_secret:'#',
    token: user_token,
    secret: user_secret,
    user_id: fitbit_user_id,
  })


  access_token = client.reconnect(user_token, user_secret)
  client = [client.heart_rate_on_date("today"), client.heart_rate_on_date("yesterday")]
end

 

Ive uploaded the result as a image so you can an idea what i mean when i say 'it shows as 0'.

http://imgur.com/KlIFtGk

 

Have a nice weekend!

 

-K.

Best Answer
0 Votes
1 REPLY 1

I actually just found out the reason why i couldn't get the heart-rates. Fitgem is using Oauth 1.0.

Is there a way that i can still retrieve heart-rates with Oauth 1.0. or is Oauth 2.0. absolutely required?

Best Answer
0 Votes