From fbd51e69f2bb801d1b78e79d17bbf18089144358 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 3 Mar 2021 15:22:38 +0100 Subject: Upgrade server dependencies --- server/middlewares/oauth.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'server/middlewares/oauth.ts') diff --git a/server/middlewares/oauth.ts b/server/middlewares/oauth.ts index 47799153a..280595acc 100644 --- a/server/middlewares/oauth.ts +++ b/server/middlewares/oauth.ts @@ -32,6 +32,7 @@ function authenticateSocket (socket: Socket, next: (err?: any) => void) { logger.debug('Checking socket access token %s.', accessToken) if (!accessToken) return next(new Error('No access token provided')) + if (typeof accessToken !== 'string') return next(new Error('Access token is invalid')) getAccessToken(accessToken) .then(tokenDB => { @@ -41,7 +42,7 @@ function authenticateSocket (socket: Socket, next: (err?: any) => void) { return next(new Error('Invalid access token.')) } - socket.handshake.query['user'] = tokenDB.User + socket.handshake.auth.user = tokenDB.User return next() }) -- cgit v1.2.3