app/Http/Middleware/Authenticate.php
/**
     * Overrides standard authentication handle function so that the frontend will never have to
     * store the jwt token somewhere and can get it directly from the cookie
     */
Overrides standard authentication handle function so that the frontend will never have to
store the jwt token somewhere and can get it directly from the cookie
Overrides standard authentication handle function so that the frontend will never have to store the jwt token somewhere and can get it directly from the cookie
public function handle($request, Closure $next, ...$guards)
    {
        if($jwt = $request->cookie('jwt')) {
            $request->headers->set('Authorization', 'Bearer ' . $jwt);
        }
        $this->authenticate($request, $guards);
        return $next($request);
    }
public function handle ( $ request , Closure $ next , ... $ guards ) { if ( $ jwt = $ request -> cookie ( 'jwt' ) ) { $ request -> headers -> set ( 'Authorization' , 'Bearer ' . $ jwt ) ; } $ this -> authenticate ( $ request , $ guards ) ; return $ next ( $ request ) ; }
Overrides standard authentication handle function so that the frontend will never have to
 store the jwt token somewhere and can get it directly from the cookie
Overrides standard authentication handle function so that the frontend will never have to store the jwt token somewhere and can get it directly from the cookie