aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/middlewares
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-03-03 15:22:38 +0100
committerChocobozzz <me@florianbigard.com>2021-03-03 16:14:32 +0100
commitfbd51e69f2bb801d1b78e79d17bbf18089144358 (patch)
treee0784580bdf87aab1b841e8cb9439568ffb48f97 /server/middlewares
parentf55cc0f97ac1689e43415e32e6a01e98366902e7 (diff)
downloadPeerTube-fbd51e69f2bb801d1b78e79d17bbf18089144358.tar.gz
PeerTube-fbd51e69f2bb801d1b78e79d17bbf18089144358.tar.zst
PeerTube-fbd51e69f2bb801d1b78e79d17bbf18089144358.zip
Upgrade server dependencies
Diffstat (limited to 'server/middlewares')
-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 })