lib/omniauth/strategies/facebook.rb in oa-oauth-0.2.4 vs lib/omniauth/strategies/facebook.rb in oa-oauth-0.2.5
- old
+ new
@@ -14,20 +14,20 @@
# @param [String] client_secret the application secret as registered on Facebook
# @option options [String] :scope ('email,offline_access') comma-separated extended permissions such as `email` and `manage_pages`
def initialize(app, client_id = nil, client_secret = nil, options = {}, &block)
super(app, :facebook, client_id, client_secret, {:site => 'https://graph.facebook.com/'}, options, &block)
end
-
+
def user_data
@data ||= MultiJson.decode(@access_token.get('/me', {}, { "Accept-Language" => "en-us,en;"}))
end
-
+
def request_phase
options[:scope] ||= "email,offline_access"
super
end
-
+
def build_access_token
if facebook_session.nil? || facebook_session.empty?
super
else
@access_token = ::OAuth2::AccessToken.new(client, facebook_session['access_token'])
@@ -39,11 +39,11 @@
if session_cookie
@facebook_session ||= Rack::Utils.parse_query(request.cookies["fbs_#{client.id}"].gsub('"', ''))
else
nil
end
- end
+ end
def user_info
{
'nickname' => user_data["link"].split('/').last,
'email' => (user_data["email"] if user_data["email"]),
@@ -55,10 +55,10 @@
'Facebook' => user_data["link"],
'Website' => user_data["website"],
}
}
end
-
+
def auth_hash
OmniAuth::Utils.deep_merge(super, {
'uid' => user_data['id'],
'user_info' => user_info,
'extra' => {'user_hash' => user_data}