You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Swoole:https://www.swoole.co.uk/docs/modules/swoole-websocket-server
The code is running under php artisan command, and websocket is turned on.
When the token expired, I refreshed the front page for the first time, the result was normal, and I got the refresh token. Save the refresh token to the localstore.
Wait for 1 minute to make sure that the token has expired, and refresh the page for the second time, at this time there is no refresh token.
public function handle()
{
$ws = new Server('0.0.0.0', 9501);
$ws->on('open', function (Server $ws, $request) {
echo "server: handshake success with fd{$request->fd}\n";
});
$ws->on('message', function (Server $ws, $frame) {
echo "receive from {$frame->fd}:{$frame->data},opcode:{$frame->opcode},fin:{$frame->finish}\n";
try {
JWTAuth::setToken($frame->data->token);
$user = JWTAuth::authenticate();
} catch (TokenExpiredException $e) {
$this->info('Refresh:'.$e->getMessage());
$refresh_token = JWTAuth::refresh();
JWTAuth::setToken($msg->data);
$user = JWTAuth::authenticate();
} catch (TokenInvalidException $e) {
// relogin
$this->info('Relogin:'.$e->getMessage());
} catch (JWTException $e) {
$this->info('Relogin:'.$e->getMessage());
}
});
$ws->on('close', function ($ser, $fd) {
echo "client {$fd} closed\n";
});
$ws->start();
}
Expected behaviour
Tell us what should happen
Actual behaviour
Tell us what happens instead
The text was updated successfully, but these errors were encountered:
Subject of the issue
Describe your issue here.
Your environment
use jwt-auth in php cli with Swoole.
Swoole:https://www.swoole.co.uk/docs/modules/swoole-websocket-server
The code is running under php artisan command, and websocket is turned on.
When the token expired, I refreshed the front page for the first time, the result was normal, and I got the refresh token. Save the refresh token to the localstore.
Wait for 1 minute to make sure that the token has expired, and refresh the page for the second time, at this time there is no refresh token.
Expected behaviour
Tell us what should happen
Actual behaviour
Tell us what happens instead
The text was updated successfully, but these errors were encountered: