gpt4 book ai didi

ruby-on-rails - 无法在Rails中验证CSRF token 的真实性

转载 作者:行者123 更新时间:2023-12-04 04:45:11 27 4
gpt4 key购买 nike

我正在使用PaypalAdaptive。它会正确发送ipn_notification。 ipnNotification操作方法如下-

def ipn_notification
ipn = PaypalAdaptive::IpnNotification.new
ipn.send_back(request.raw_post.to_json)

print "=====================request.raw_post#{request.raw_post}=============="

if ipn.verified?
PaymentMailer.notify_unknown(request.raw_post).deliver
else
logger.info "IT DIDNT WORK"
end
render :nothing => true
end

但它返回错误
WARNING: Can't verify CSRF token authenticity rails

对这个问题有任何帮助。

最佳答案

在您的 Controller 中:

skip_before_filter :verify_authenticity_token, :only => [:ipn_notification]

对于快速阅读并分发-1的人(跳过重要部分:这不是来自客户端的POST调用...):
  • 是,它会跳过安全性,但请稍候...
  • 是的,这是外部网站POST请求的唯一方法
  • 是的,这很安全:接到Paypal或类似的电话时,您显然要检查参数和键。
  • 关于ruby-on-rails - 无法在Rails中验证CSRF token 的真实性,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11986939/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com