jwt the token I refreshed in the middleware will be blacklisted by jwt after the old token is refreshed. At this time, if the controller uses JWTAuth::getToken ()
to get token, it will prompt The token has been blacklisted
what to do? How do I get this new token in the controller"s index method?
Route::group(["namespace" => "Api"], function(){
Route::middleware(["refresh"])->group(function () {
Route::post("index", "AuthController@index");
});
});
Middleware
$old_token = JWTAuth::getToken();
$token = JWTAuth::refresh($old_token);
AuthController
public function index() {
$token = JWTAuth::getToken();
$user = JWTAuth::parseToken()->authenticate();
dd($user);
}