diff --git a/.gitignore b/.gitignore index 97ae1f1..af64fae 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,3 @@ db/*.sqlite3 log/*.log tmp/**/* -Gemfile.lock diff --git a/Gemfile b/Gemfile index 2bd9651..9088643 100644 --- a/Gemfile +++ b/Gemfile @@ -2,5 +2,4 @@ source 'http://rubygems.org' gem 'rails', '3.0.6' gem 'sqlite3-ruby', :require => 'sqlite3' -gem 'fb_graph', '>=1.6.5' -gem 'rack-oauth2', '>=0.5.1' +gem 'fb_graph', '>=1.7.0.alpha2' \ No newline at end of file diff --git a/Gemfile.lock b/Gemfile.lock new file mode 100644 index 0000000..490d224 --- /dev/null +++ b/Gemfile.lock @@ -0,0 +1,91 @@ +GEM + remote: http://rubygems.org/ + specs: + abstract (1.0.0) + actionmailer (3.0.6) + actionpack (= 3.0.6) + mail (~> 2.2.15) + actionpack (3.0.6) + activemodel (= 3.0.6) + activesupport (= 3.0.6) + builder (~> 2.1.2) + erubis (~> 2.6.6) + i18n (~> 0.5.0) + rack (~> 1.2.1) + rack-mount (~> 0.6.14) + rack-test (~> 0.5.7) + tzinfo (~> 0.3.23) + activemodel (3.0.6) + activesupport (= 3.0.6) + builder (~> 2.1.2) + i18n (~> 0.5.0) + activerecord (3.0.6) + activemodel (= 3.0.6) + activesupport (= 3.0.6) + arel (~> 2.0.2) + tzinfo (~> 0.3.23) + activeresource (3.0.6) + activemodel (= 3.0.6) + activesupport (= 3.0.6) + activesupport (3.0.6) + arel (2.0.9) + attr_required (0.0.3) + builder (2.1.2) + erubis (2.6.6) + abstract (>= 1.0.0) + fb_graph (1.7.0.alpha2) + rack-oauth2 (>= 0.6.5) + i18n (0.5.0) + json (1.5.1) + mail (2.2.17) + activesupport (>= 2.3.6) + i18n (>= 0.4.0) + mime-types (~> 1.16) + treetop (~> 1.4.8) + mime-types (1.16) + polyglot (0.3.1) + rack (1.2.2) + rack-mount (0.6.14) + rack (>= 1.0.0) + rack-oauth2 (0.6.5) + activesupport (>= 2.3) + attr_required (>= 0.0.3) + i18n + json (>= 1.4.3) + rack (>= 1.1) + restclient_with_cert + rack-test (0.5.7) + rack (>= 1.0) + rails (3.0.6) + actionmailer (= 3.0.6) + actionpack (= 3.0.6) + activerecord (= 3.0.6) + activeresource (= 3.0.6) + activesupport (= 3.0.6) + bundler (~> 1.0) + railties (= 3.0.6) + railties (3.0.6) + actionpack (= 3.0.6) + activesupport (= 3.0.6) + rake (>= 0.8.7) + thor (~> 0.14.4) + rake (0.8.7) + rest-client (1.6.1) + mime-types (>= 1.16) + restclient_with_cert (0.0.5) + rest-client (>= 1.6) + sqlite3 (1.3.3) + sqlite3-ruby (1.3.3) + sqlite3 (>= 1.3.3) + thor (0.14.6) + treetop (1.4.9) + polyglot (>= 0.3.1) + tzinfo (0.3.26) + +PLATFORMS + ruby + +DEPENDENCIES + fb_graph (>= 1.7.0.alpha2) + rails (= 3.0.6) + sqlite3-ruby diff --git a/app/controllers/facebooks_controller.rb b/app/controllers/facebooks_controller.rb index acdee4d..df9abc3 100644 --- a/app/controllers/facebooks_controller.rb +++ b/app/controllers/facebooks_controller.rb @@ -20,7 +20,7 @@ def new # handle Normal OAuth flow: callback def create client.authorization_code = params[:code] - access_token = client.access_token![:access_token] + access_token = client.access_token! user = FbGraph::User.me(access_token).fetch authenticate Facebook.identify(user) redirect_to dashboard_url @@ -34,13 +34,11 @@ def destroy private def client - @client ||= Rack::OAuth2::Client.new( - :identifier => Facebook.config[:client_id], - :secret => Facebook.config[:client_secret], - :redirect_uri => callback_facebook_url, - :authorization_endpoint => 'https://www.facebook.com/dialog/oauth', - :token_endpoint => 'https://graph.facebook.com/oauth/access_token' - ) + unless @client + @client = Facebook.auth.client + @client.redirect_uri = callback_facebook_url + end + @client end end