fix
This commit is contained in:
@@ -3,6 +3,10 @@ import * as roomService from './rooms.service';
|
||||
import { getUserById } from '../user/user.service';
|
||||
import jwt from 'jsonwebtoken';
|
||||
|
||||
import {getConfig} from '../../shared/config';
|
||||
const { values } = getConfig();
|
||||
const jwtSecret = values.server?.jwt_secret;
|
||||
|
||||
interface WSClient {
|
||||
socket: any;
|
||||
userId: string;
|
||||
@@ -68,7 +72,7 @@ async function handleWebSocketConnection(connection: any, req: any) {
|
||||
// 2. MOVIDO ARRIBA: Autenticar usuario PRIMERO para saber quién es
|
||||
if (token) {
|
||||
try {
|
||||
const decoded: any = jwt.verify(token, process.env.JWT_SECRET!);
|
||||
const decoded: any = jwt.verify(token, jwtSecret);
|
||||
realUserId = decoded.id;
|
||||
const user = await getUserById(realUserId);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user