twilio-ruby gem을 사용하여 요청이 twilio에서오고 있음을 확인하지만 twilio 요청을 항상 잘못 검증합니다. 여기 내가 지금까지 가지고있는 것입니다Twilio-Ruby 유효성 검사 오류가 발생했습니다.
class CallsController < ApplicationController
before_filter :authenticate_request
private
# This action validates that the request are coming from twilio. It uses the twilio-ruby gem
# to validate that the twilio signature, url, and params are correctly from twilio
def authenticate_request
twilio_signature = request.headers['HTTP_X_TWILIO_SIGNATURE']
validator = Twilio::Util::RequestValidator.new(ENV['TWILIO_AUTH'])
verified = validator.validate(request.url, params, twilio_signature)
unless verified
response = Twilio::TwiML::Response.new do |r|
r.Say 'Unvalidated request'
r.Hangup
end
render :xml => response.text
end
end
end