如何使用lumen刷新jwt中的令牌?

如何使用lumen刷新jwt中的令牌?,jwt,lumen,lumen-5.2,Jwt,Lumen,Lumen 5.2,I使用流明(5.2)框架和jwt(1.0) 我得到一个令牌,但我不能刷新它,因为系统告诉我“该令牌已被列入黑名单”。我不知道是怎么解决的。你能帮帮我吗 原谅我,我的英语不是很好,可能在表达上有一些差异 路线 登录 刷新 身份验证服务提供商 我已经解决了这个问题 首先,我删除了jwt.refresh中间件。然后我使用JWT管理器刷新我的令牌 这是现在的代码 $app->group(['prefix' => 'auth', 'namespace' => '\App\Http\Con

I使用流明(5.2)框架和jwt(1.0)

我得到一个令牌,但我不能刷新它,因为系统告诉我“该令牌已被列入黑名单”。我不知道是怎么解决的。你能帮帮我吗

原谅我,我的英语不是很好,可能在表达上有一些差异

路线 登录 刷新 身份验证服务提供商
我已经解决了这个问题

首先,我删除了
jwt.refresh
中间件。然后我使用JWT管理器刷新我的令牌

这是现在的代码

$app->group(['prefix' => 'auth', 'namespace' => '\App\Http\Controllers'], function () use ($app) {

    $app->post('/signin', 'AuthController@signin');
    $app->put('/refresh', 'AuthController@refresh');

});
控制器
我可以知道你用的是什么版本的JWT吗?我也有同样的问题,我也这么做了,但问题仍然存在。我使用的是
1.0.0-beta.3
我使用的是lumen 8.0,此解决方案适用于此lumen版本吗?
public function signin(Request $request)
{
    $this->validate($request, [
        'email'    => 'required|email|max:255',
        'password' => 'required'
    ]);

    try {

        if ($token = $this->jwt->attempt($request->only(['email', 'password']))) {
            return $this->json([
                'token' => $token
            ]);
        }

        return $this->json([], 403, $this->_lang['signin_incorrect']);

    } catch (JWTException $e) {
        return $this->json([], 500, $e->getMessage());
    }

}
public function refresh()
{

    try {
        $this->jwt->setToken($this->jwt->getToken());

        if($this->jwt->invalidate()) {
            return $this->json([
                'token' => $this->jwt->refresh()
            ]);
        }

        return $this->json([], 403, $this->_lang['token_incorrect']);


    } catch (JWTException $e) {
        return $this->json([], 500, $e->getMessage());
    }
}
public function boot()
{
    // Here you may define how you wish users to be authenticated for your Lumen
    // application. The callback which receives the incoming request instance
    // should return either a User instance or null. You're free to obtain
    // the User instance via an API token or any other method necessary.

    $this->app['auth']->viaRequest('api', function ($request)
    {
        return \App\Models\User::where('email', $request->input('email'))->first();
    });
}
$app->group(['prefix' => 'auth', 'namespace' => '\App\Http\Controllers'], function () use ($app) {

    $app->post('/signin', 'AuthController@signin');
    $app->put('/refresh', 'AuthController@refresh');

});
return $this->json([
            'token' => $this->manager->refresh($this->jwt->getToken())->get()
        ]);