<commit_before>module Identity
  module AuthHelpers
    include LogHelpers

    # Performs the authorization step of the OAuth dance against the Heroku
    # API.
    def authorize(params, confirm=false)
      api = HerokuAPI.new(user: nil, pass: <PASSWORD>.access_token,
        request_id: request_id)

      res = log :get_client, client_id: params["client_id"] do
        api.get(path: "/oauth/clients/#{params["client_id"]}", expects: 200)
      end
      client = MultiJson.decode(res.body)

      # if the client is not trusted, then see if the user has already
      # authorized it<commit_msg>Explicit throw on missing client_id<commit_after>module Identity
  module AuthHelpers
    include LogHelpers

    # Performs the authorization step of the OAuth dance against the Heroku
    # API.
    def authorize(params, confirm=false)
      api = HerokuAPI.new(user: nil, pass: <PASSWORD>,
        request_id: request_id)

      halt 400, "Need client_id" unless params["client_id"]

      res = log :get_client, client_id: params["client_id"] do
        api.get(path: "/oauth/clients/#{params["client_id"]}", expects: 200)
      end
      client = MultiJson.decode(res.body)

      # if the client is not trusted, then see if the user has already
      # authorized it
{'fraction_non_alphanumeric': 0.09262166405023547, 'fraction_numerical': 0.00706436420722135, 'mean_word_length': 3.180327868852459, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '3368941', 'n_tokens_mistral': 388, 'n_tokens_neox': 371, 'n_words': 121}