<commit_before>require 'gigya_api'
require 'omniauth'
require 'rack/utils'

module OmniAuth
  module Strategies
    class Gigya
      include OmniAuth::Strategy

      class AuthorizationError < StandardError; end

      args [:api_key, :secret]

      def callback_phase
        request = Rack::Request.new env
        client = GigyaApi::Socialize.new api_key: options.api_key, secret: options.secret
        code = request.params['authCode']
        resp = client.get_token grant_type: "authorization_code", code: code
        if resp['statusCode'] == 200
          token = resp['access_token']
          user = client.get_user_info oauth_token: token
          unless user['statusCode'] == 200
            return user
          else
            raise AuthorizationError, "Error getting user: #{resp.to_s}"
          end
        else
          raise AuthorizationError, "Error getting auth: #{resp.to_s}"
        end
        super
      end
<commit_msg>Updated user auth error message<commit_after>require 'gigya_api'
require 'omniauth'
require 'rack/utils'

module OmniAuth
  module Strategies
    class Gigya
      include OmniAuth::Strategy

      class AuthorizationError < StandardError; end

      args [:api_key, :secret]

      def callback_phase
        request = Rack::Request.new env
        client = GigyaApi::Socialize.new api_key: options.api_key, secret: options.secret
        code = request.params['authCode']
        resp = client.get_token grant_type: "authorization_code", code: code
        if resp['statusCode'] == 200
          token = resp['access_token']
          user = client.get_user_info oauth_token: token
          unless user['statusCode'] == 200
            return user
          else
            raise AuthorizationError, "Error getting user: #{user.to_s}"
          end
        else
          raise AuthorizationError, "Error getting auth: #{resp.to_s}"
        end
        super
      end

{'fraction_non_alphanumeric': 0.08402489626556017, 'fraction_numerical': 0.006224066390041493, 'mean_word_length': 2.4262877442273534, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '5194619', 'n_tokens_mistral': 555, 'n_tokens_neox': 526, 'n_words': 148}