aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares/oauth.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/middlewares/oauth.ts')
-rw-r--r--server/middlewares/oauth.ts3
1 files changed, 2 insertions, 1 deletions
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) {
32 logger.debug('Checking socket access token %s.', accessToken) 32 logger.debug('Checking socket access token %s.', accessToken)
33 33
34 if (!accessToken) return next(new Error('No access token provided')) 34 if (!accessToken) return next(new Error('No access token provided'))
35 if (typeof accessToken !== 'string') return next(new Error('Access token is invalid'))
35 36
36 getAccessToken(accessToken) 37 getAccessToken(accessToken)
37 .then(tokenDB => { 38 .then(tokenDB => {
@@ -41,7 +42,7 @@ function authenticateSocket (socket: Socket, next: (err?: any) => void) {
41 return next(new Error('Invalid access token.')) 42 return next(new Error('Invalid access token.'))
42 } 43 }
43 44
44 socket.handshake.query['user'] = tokenDB.User 45 socket.handshake.auth.user = tokenDB.User
45 46
46 return next() 47 return next()
47 }) 48 })