After 2 DAYS i can not understand how to do a logout method!!!
public function logout(Request $request)
{
$user = JWTAuth::parseToken()->toUser();
JWTAuth::invalidate(JWTAuth::parseToken());
$authuser=Auth::user();
$user2 = JWTAuth::parseToken()->toUser();
return response()->json([$user,$authuser,$user2],200);
or get always a user autenticated or get a exception in all test!?but, the documentation don't say nothig about logout method!!!!
$token=JWTAuth::getToken();JWTAuth::invalidate($token);
You may want the extra security of invalidating the token on the server, but for many (simple) applications, removing the token from the client will effectively logout the user. In my apps, that usually looks something like this in Javascript: localStorage.removeItem('auth_token'); replacing "auth_token" with whatever variable you're using.
Perhaps you should look at this document. http://jwt-auth.readthedocs.io/en/develop/auth-guard/
Most helpful comment
$token=JWTAuth::getToken();JWTAuth::invalidate($token);