Skip to content

Commit f9a6708

Browse files
committed
Merge pull request #3 from codebender/updates_for_live_api
Updates for live OAuth 2.0 API
2 parents 2aa948a + e5bcf28 commit f9a6708

File tree

5 files changed

+13
-19
lines changed

5 files changed

+13
-19
lines changed

README.md

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
11
# OmniAuth OAuth2 strategy for Fitbit
2-
This gem is an OAuth2 OmniAuth Strategy for the [Fitbit API](https://wiki.fitbit.com/display/API/OAuth+2.0).
2+
This gem is an OAuth2 OmniAuth Strategy for the [Fitbit API](https://dev.fitbit.com/docs/oauth2/).
33

44
## Gem Status
55
[![Gem Version](https://badge.fury.io/rb/omniauth-fitbit-oauth2.svg)](http://badge.fury.io/rb/omniauth-fitbit-oauth2)
66
[![Build Status](https://semaphoreci.com/api/v1/projects/2fae3e5c-5bb1-4cf6-8d58-de1656ff3751/425290/shields_badge.svg)](https://semaphoreci.com/codebender/omniauth-fitbit-oauth2)
77

8-
## Fitbit Beta Notice
9-
:warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning:
10-
11-
*This feature is in a beta state.
12-
During this period, Fitbit may need to make backwards incompatible changes with less than 30 days notice. Fitbit does NOT recommend using OAuth 2.0 in a production environment yet.
13-
With your help testing, we hope to resolve any issues over the next few months. When we believe it is production ready, we will update this post.*
14-
15-
:warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning: :warning:
16-
178
## Installing
189

1910
Add to your `Gemfile`:
File renamed without changes.

exmaple/config.ru renamed to example/config.ru

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ use Rack::Session::Cookie
2222

2323
use OmniAuth::Builder do
2424
provider :fitbit_oauth2, ENV['FITBIT_CLIENT_ID'], ENV['FITBIT_CLIENT_SECRET'],
25-
:scope => 'activity sleep'
25+
:scope => 'profile activity sleep', :expires_in => '2592000',
26+
:prompt => 'login'
2627
end
2728

2829
run App.new

lib/omniauth/strategies/fitbit_oauth2.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class FitbitOauth2 < OmniAuth::Strategies::OAuth2
1313
:token_url => 'https://api.fitbit.com/oauth2/token'
1414
}
1515

16-
option :authorize_options, [:scope, :response_type]
16+
option :authorize_options, [:scope, :response_type, :expires_in, :prompt]
1717
option :response_type, 'code'
1818

1919
def build_access_token
@@ -28,7 +28,9 @@ def basic_auth_header
2828
end
2929

3030
def query_string
31-
'' # The state and code params shouldn't be sent as part of the callback_url in the callback phase
31+
# The state and code params shouldn't be sent as part of the
32+
# callback_url in the callback phase
33+
''
3234
end
3335

3436
uid do
@@ -61,12 +63,12 @@ def query_string
6163

6264
def raw_info
6365
if options[:use_english_measure] == 'true'
64-
@raw_info ||= MultiJson.load(access_token.
66+
@raw_info ||= access_token.
6567
request('get', 'https://api.fitbit.com/1/user/-/profile.json',
66-
{ 'Accept-Language' => 'en_US' }).body)
68+
{ 'Accept-Language' => 'en_US' }).parsed
6769
else
68-
@raw_info ||= MultiJson.load(access_token.
69-
get('https://api.fitbit.com/1/user/-/profile.json').body)
70+
@raw_info ||= access_token.
71+
get('https://api.fitbit.com/1/user/-/profile.json').parsed
7072
end
7173
end
7274
end

omniauth-fitbit-oauth2.gemspec

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Gem::Specification.new do |gem|
66
gem.version = OmniAuth::FitbitOauth2::VERSION
77
gem.license = 'MIT'
88
gem.summary = %q{OmniAuth Oauth2 strategy for fitbit.com.}
9-
gem.description = %q{OmniAuth Oauth2 strategy for fitbit.com - https://wiki.fitbit.com/display/API/OAuth+2.0}
9+
gem.description = %q{OmniAuth Oauth2 strategy for fitbit.com - https://dev.fitbit.com/docs/oauth2/}
1010
gem.author = 'Matthew Bender'
1111
gem.email = '[email protected]'
1212
gem.homepage = 'https://github.com/codebender/omniauth-fitbit-oauth2'
@@ -18,5 +18,5 @@ Gem::Specification.new do |gem|
1818

1919
gem.add_runtime_dependency 'omniauth-oauth2', '~> 1.3'
2020

21-
gem.add_development_dependency 'rspec', '~> 3.2'
21+
gem.add_development_dependency 'rspec', '~> 3.3'
2222
end

0 commit comments

Comments
 (0)