mardi 12 juin 2018

Laravel token mismatch error after cache clear

I am using Laravel 5.4 version

What i eana ask when i am clear the browser cache and try to login this time it returning me the error like

TokenMismatchException in VerifyCsrfToken.php line 68:

but when i refresh it again and login it logged in succesufully but whenever i clear the browser cache and try to login all the time it returning me the error . can any one please help me related this ??

code i have in my v\VerifyCsrfToken.php is:

public function handle($request, Closure $next)
    {
        if (
            $this->isReading($request) ||
            $this->runningUnitTests() ||
            $this->shouldPassThrough($request) ||
            $this->tokensMatch($request)
        ) {
            return $this->addCookieToResponse($request, $next($request));
        }

        throw new TokenMismatchException;
    }

but when i am using this code instead of laravel default :

public function handle($request, Closure $next)
    {
        $response = $next($request);

        if (last(explode('\\',get_class($response))) != 'RedirectResponse') {
            $response->header('P3P', 'CP="IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT"');
        }

        return $response;
    }

its working fine it means after cahe clear it allow me to login without giving the token mismatch error

my question is i dont want to change the default code of laravel so is there any other way to solve this ???



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2HEm9xL
via IFTTT

Aucun commentaire:

Enregistrer un commentaire