lib/wolf_core/application/burnett/auth/auth_operations.rb



module WolfCore
  module Burnett
    module Auth
      module Operations
        def get_erecruit_access_token
          response = safe_http_post(
            url: ENV['ERECRUIT_AUTH_URL'],
            headers: { 'Content-Type' => 'application/x-www-form-urlencoded' },
            body: {
              client_id: ENV['ERECRUIT_AUTH_CLIENT_ID'],
              client_secret: ENV['ERECRUIT_AUTH_CLIENT_SECRET'],
              grant_type: ENV['ERECRUIT_AUTH_GRANT_TYPE'],
            },
            error_message: 'Unable to get erecruit token'
          )
          access_token = response.body['access_token']
          access_token
        end
      end
    end
  end
end