Q:

Twilio returning authenticate error for my local machine only

My team and I are using twilio to send sms messages. Everything seems to work fine on everyone else's local machine (with the same exact code) except twilio always returns an authenticate error to me. I'm sending the messages to their "special number" so it won't actually send a real text message but it still returns an authenticate error. 
here's some of our code to send the message:
def send_sms
  self.from_phone_number = CONFIG['live_twilio'] ? self.customer.assigned_phone_number : CONFIG['test_phone_number']
  self.to_phone_number   = CONFIG['live_twilio'] ? self.customer.customer_phone_number : CONFIG['test_phone_number']

  begin
    report_to_new_relic_insights
    send_message_with_twilio!
  rescue Twilio::REST::RequestError => e
    self.error_description = e.message
  end

  self.dispatched_at = Time.now
  self.save(validate: false)

  return e
end

def send_message_with_twilio!
  unless self.customer.example_customer?
    twilio_params = {
      from: "+1#{from_phone_number}",
      to:   "+1#{to_phone_number}",
      body: self.text
    }

    if ENV['RECORD_TWILIO_STATUSES'].in?(['1', 'true'])
      twilio_params[:status_callback] = "#{CONFIG['secure_domain']}/messages/#{id}/update_status"
    end

    client.account.messages.create(twilio_params)
  else
    # @onboarding_flow
    # don't send the actual SMS to the example customer
    self.customer.send_reply_as_example_customer! if self.customer.first_reply?
  end
end

def client
   @client ||= begin
     account_sid = ENV['ACCOUNT_SID'] || CONFIG['account_sid']
     auth_token  = ENV['AUTH_TOKEN']  || CONFIG['auth_token']
     Twilio::REST::Client.new account_sid, auth_token
   end
end

every time this line runs: client.account.messages.create(twilio_params)
it returns authenticate error. it works on every other local machine except for mine. all of the code is exactly the same, the auth tokens are exactly the same. any ideas what the problem could be? (the auth tokens are getting pulled from config.yml
More info: even when running the bare bones twilio client in console with the same exact info in both machines, mine returns an error and my coworkers returns valid

A:

Twilio evangelist here.
This could be one of many things, but the only reason Twilio would complain about authentication, is if you have a wrong account SID or auth token.
So can pretty much guarantee this is the bit that is going wrong:
def client
   @client ||= begin
     account_sid = ENV['ACCOUNT_SID'] || CONFIG['account_sid']
     auth_token  = ENV['AUTH_TOKEN']  || CONFIG['auth_token']
     Twilio::REST::Client.new account_sid, auth_token
   end
end

My suggestion here is for you to open up your terminal and run:
$ printenv

This should print all your environment variables for you. You're interested on ACCOUNT_SID and AUTH_TOKEN, so you could get those specific values from terminal as follows:
$ printenv | grep "ACCOUNT_SID\|AUTH_TOKEN"

Then check with your peers if you are using the same values. Please let me know the outcome.

