Fix JWT validation: use user_id instead of sub in socket servers, revert statusDriverLocation from toggleActive
This commit is contained in:
@@ -209,7 +209,7 @@ $io->on('connection', function ($socket) {
|
||||
socket_log("[WARNING] JWT Secret is not configured on the server!");
|
||||
} else {
|
||||
$decoded = JWT::decode($jwtToken, new Key($secretKey, 'HS256'));
|
||||
if ((string)$decoded->sub !== (string)$passengerId || $decoded->role !== 'passenger') {
|
||||
if ((string)$decoded->user_id !== (string)$passengerId || $decoded->role !== 'passenger') {
|
||||
socket_log("[SOCKET_REJECTED] Connection rejected: Invalid JWT for passenger_id=$passengerId from IP: $clientIp");
|
||||
$socket->disconnect();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user