CSRF_EXEMPT无法在我的Django项目中使用

发布于 2025-01-31 11:38:18 字数 701 浏览 1 评论 0原文

我正在使用django 3.2我试图在我的网站上使用twilio webhook,但仍然遇到错误

403 forbidden
<p>CSRF verification failed. Request aborted.</p>


  <p>You are seeing this message because this site requires a CSRF cookie
    when submitting forms. This cookie is required for security reasons, to
    ensure that your browser is not being hijacked by third parties.</p>
  <p>If you have configured your browser to disable cookies, please
    re-enable them, at least for this site, or for “same-origin” requests.</p>

我的视图

@csrf_exempt
@validate_twilio_request
def webhook(request):
    return HttpResponse("something")

我在做什么错?

I am using django 3.2 I am trying to use a twilio webhook on my site but still getting the error

403 forbidden
<p>CSRF verification failed. Request aborted.</p>


  <p>You are seeing this message because this site requires a CSRF cookie
    when submitting forms. This cookie is required for security reasons, to
    ensure that your browser is not being hijacked by third parties.</p>
  <p>If you have configured your browser to disable cookies, please
    re-enable them, at least for this site, or for “same-origin” requests.</p>

my view

@csrf_exempt
@validate_twilio_request
def webhook(request):
    return HttpResponse("something")

what are my doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文