From 8484d7cca51660e01b656a6335bfc9c7ba658444 Mon Sep 17 00:00:00 2001 From: Mark Dodwell Date: Sat, 15 Oct 2011 19:58:33 -0700 Subject: [PATCH] set uid from raw_info --- lib/omniauth/strategies/facebook.rb | 2 ++ spec/omniauth/strategies/facebook_spec.rb | 7 +++++++ 2 files changed, 9 insertions(+) diff --git a/lib/omniauth/strategies/facebook.rb b/lib/omniauth/strategies/facebook.rb index 0b9e24d..65c7dfc 100644 --- a/lib/omniauth/strategies/facebook.rb +++ b/lib/omniauth/strategies/facebook.rb @@ -16,6 +16,8 @@ module OmniAuth :header_format => 'OAuth %s', :param_name => 'access_token' } + + uid { raw_info['id'] } def build_access_token super.tap do |token| diff --git a/spec/omniauth/strategies/facebook_spec.rb b/spec/omniauth/strategies/facebook_spec.rb index 5e6f1e9..f6d8116 100644 --- a/spec/omniauth/strategies/facebook_spec.rb +++ b/spec/omniauth/strategies/facebook_spec.rb @@ -43,4 +43,11 @@ describe OmniAuth::Strategies::Facebook do subject.access_token_options[:header_format].should eq('OAuth %s') end end + + describe '#uid' do + it 'returns the id from raw_info' do + subject.stub(:raw_info) { { 'id' => '123' } } + subject.uid.should eq('123') + end + end end