lib/omniauth/strategies/facebook.rb in oa-oauth-0.1.4 vs lib/omniauth/strategies/facebook.rb in oa-oauth-0.1.5

- old
+ new

@@ -1,29 +1,27 @@ require 'omniauth/oauth' require 'multi_json' module OmniAuth module Strategies - # # Authenticate to Facebook utilizing OAuth 2.0 and retrieve # basic user information. # - # Usage: - # - # use OmniAuth::Strategies::Facebook, 'app_id', 'app_secret' - # - # Options: - # - # <tt>:scope</tt> :: Extended permissions such as <tt>email</tt> and <tt>offline_access</tt> (which are the defaults). + # @example Basic Usage + # use OmniAuth::Strategies::Facebook, 'app_id', 'app_secret' class Facebook < OAuth2 + # @param [Rack Application] app standard middleware application parameter + # @param [String] app_id the application id as [registered on Facebook](http://www.facebook.com/developers/) + # @param [String] app_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, app_id, app_secret, options = {}) options[:site] = 'https://graph.facebook.com/' super(app, :facebook, app_id, app_secret, options) end def user_data - @data ||= MultiJson.decode(@access_token.get('/me')) + @data ||= MultiJson.decode(@access_token.get('/me', {}, { "Accept-Language" => "en-us,en;"})) end def request_phase options[:scope] ||= "email,offline_access" super @@ -49,6 +47,6 @@ 'extra' => {'user_hash' => user_data} }) end end end -end +end \ No newline at end of file