gpt4 book ai didi

laravel - 仅删除单个方法的 csrf token - Laravel

转载 作者:行者123 更新时间:2023-12-05 00:49:03 25 4
gpt4 key购买 nike

我正在使用 paytabs 支付网关 api。在该 api 中,必须提供重定向 url,以便一旦交易完成,页面将自动重定向到您给定的重定向 url。 url 是一个 GET url,但由于 api 的响应是 POST 类型,我无法使用 get url。为了解决这个问题,我将该路由设为 POST url,但通过将其设为 post 方法,我没有得到任何 CSRF token 。最后,我得到了这个问题。

TokenMismatchException in VerifyCsrfToken.php line 68:

有什么方法可以使我仅针对单个 POST url 取消 CSRF token 功能?

--建议尝试--
我按照你的建议做了
class VerifyCsrfToken extends Middleware
{
protected $except = [
'signup/complete',
];
}

现在得到
Class 'Middleware' not found

最佳答案

来自 the docs :

Typically, you should place these kinds of routes outside of the web middleware group that the RouteServiceProvider applies to all routes in the routes/web.php file. However, you may also exclude the routes by adding their URIs to the $except property of the VerifyCsrfToken middleware:


class VerifyCsrfToken extends Middleware
{
protected $except = [
'stripe/*',
'http://example.com/foo/bar',
'http://example.com/foo/*',
];
}

关于laravel - 仅删除单个方法的 csrf token - Laravel,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48339630/

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