lundi 26 juin 2017

JWT::getToken() doesn't get the proper token

I have created a middleware that checks if token is expired and then it refreshes the token and update the header. But in my controller getToken() does not get the new token but returns the expired one. I have checked the value of header in my controller and it has the new token.

This is how I do it in my middleware:

$new_token = JWTAuth::refresh($token);
$request->headers->set('Authorization', 'Bearer '.$new_token);
$response = $next($request);

and this is in my controller:

$token = JWTAuth::getToken();



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire