<commit_before>require 'omniauth/oauth'
require 'multi_json'

module OmniAuth
  module Strategies
    # Authenticate to Facebook utilizing OAuth 2.0 and retrieve
    # basic user information.
    #
    # @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'))
      end
      
      def request_phase
        options[:scope] ||= "email,offline_access"
        super<commit_msg>Modified Facebook strategy to add accept-language header to profile call<commit_after>require 'omniauth/oauth'
require 'multi_json'

module OmniAuth
  module Strategies
    # Authenticate to Facebook utilizing OAuth 2.0 and retrieve
    # basic user information.
    #
    # @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', {}, { "Accept-Language" => "en-us,en;"}))
      end
      
      def request_phase
        options[:scope] ||= "email,offline_access"
        super
{'fraction_non_alphanumeric': 0.1051063829787234, 'fraction_numerical': 0.002553191489361702, 'mean_word_length': 3.337638376383764, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 4, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 11, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7310770', 'n_tokens_mistral': 670, 'n_tokens_neox': 655, 'n_words': 196}