<commit_before>require "omniauth/strategies/oauth2"

module OmniAuth  
  module Strategies
    class CopositionOauth2 < OmniAuth::Strategies::OAuth2
      include OmniAuth::Strategy

      PROVIDER_URL = "https://coposition.com"

      option :name, "coposition_oauth2"
      # option :skip_friends, true
      # option :skip_image_info, true
      # option :skip_jwt, true
      # option :authorize_options, [
      #   :access_type, :hd, :login_hint, :prompt, :request_visible_actions,
      #   :scope, :state, :redirect_uri, :include_granted_scopes, :openid_realm
      # ]

      option :client_options, {
        site: PROVIDER_URL,
        authorize_url: "#{PROVIDER_URL}/oauth/authorize",
        token_url: "#{PROVIDER_URL}/oauth/token"
      }

      def request_phase
        super
      end

      info do
        raw_info.merge("token" => access_token.token)
      end

      uid { raw_info["id"] }

      def raw_info
        @raw_info ||= access_token.get("#{PROVIDER_URL}/users/me").parsed
      end
    end
  end
end  <commit_msg>Use custom hash with user data for raw info<commit_after>require "omniauth/strategies/oauth2"

module OmniAuth  
  module Strategies
    class CopositionOauth2 < OmniAuth::Strategies::OAuth2
      include OmniAuth::Strategy

      PROVIDER_URL = "https://coposition.com"

      option :name, "coposition_oauth2"
      # option :skip_friends, true
      # option :skip_image_info, true
      # option :skip_jwt, true
      # option :authorize_options, [
      #   :access_type, :hd, :login_hint, :prompt, :request_visible_actions,
      #   :scope, :state, :redirect_uri, :include_granted_scopes, :openid_realm
      # ]

      option :client_options, {
        site: PROVIDER_URL,
        authorize_url: "#{PROVIDER_URL}/oauth/authorize",
        token_url: "#{PROVIDER_URL}/oauth/token"
      }

      def request_phase
        super
      end

      info do
        raw_info.merge("token" => access_token.token)
      end

      uid { raw_info["id"] }

      def raw_info
        @raw_info ||= access_token["user"]
      end
    end
  end
end  
{'fraction_non_alphanumeric': 0.10463449593884376, 'fraction_numerical': 0.003822264691829909, 'mean_word_length': 2.641739130434783, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6710012', 'n_tokens_mistral': 717, 'n_tokens_neox': 693, 'n_words': 136}