Laravel 5 and Internet Explorer : Token Mismatch

后端 未结 4 1218
小鲜肉
小鲜肉 2021-01-11 22:45

My Laravel5 website uses csrf tokens to prevent CSRF attacks. On Chrome and Firefox, eveything works fine.

I submitted the site for my client to test and, when he us

4条回答
  •  南方客
    南方客 (楼主)
    2021-01-11 23:32

    I faced the same issue, and it was due to P3P error. Faced the issue on Edge (Windows 10).

    I did a lot of research, and finally got it fixed.

    All you have to do is create a new middleware and udpate the handle function to,

    public function handle($request, Closure $next)
    {
        $response = $next($request);
        $response->header('P3P', 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
        return $response;
    }
    

    Explained it in detail at

    https://robinz.in/csrf-token-session-error-with-laravel-on-ie-edge/

提交回复
热议问题