public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
    {
        $this->dispatcher->dispatch(self::API_GUARD_FAILED, new AuthFailedEvent($request, $exception));

        return $this->removeAuthCookieFromResponse(new Response('Authentication Failed', Response::HTTP_FORBIDDEN));
    }
public function onAuthenticationFailure(Request $request, AuthenticationException $exception)
    {
        $this->dispatcher->dispatch(self::API_GUARD_FAILED, new AuthFailedEvent($request, $exception));

        return $this->removeAuthCookieFromResponse(new Response('Authentication Failed', Response::HTTP_FORBIDDEN));
    }
public function onAuthenticationFailure ( Request $ request , AuthenticationException $ exception ) { $ this -> dispatcher -> dispatch ( self :: API_GUARD_FAILED , new AuthFailedEvent ( $ request , $ exception ) ) ; return $ this -> removeAuthCookieFromResponse ( new Response ( 'Authentication Failed' , Response :: HTTP_FORBIDDEN ) ) ; }
4a ) This is fired when authentication fails.  This can be caused by expired tokens, deleted users, etc

@param Request $request
@param AuthenticationException $exception
@return Response
4a ) This is fired when authentication fails . This can be caused by expired tokens deleted users etc