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.ts8
1 files changed, 4 insertions, 4 deletions
diff --git a/server/middlewares/oauth.ts b/server/middlewares/oauth.ts
index b1149174b..bd60a3639 100644
--- a/server/middlewares/oauth.ts
+++ b/server/middlewares/oauth.ts
@@ -1,8 +1,8 @@
1import * as express from 'express' 1import * as express from 'express'
2import { logger } from '../helpers/logger'
3import { Socket } from 'socket.io' 2import { Socket } from 'socket.io'
4import { getAccessToken } from '../lib/oauth-model'
5import { oAuthServer } from '@server/lib/auth' 3import { oAuthServer } from '@server/lib/auth'
4import { logger } from '../helpers/logger'
5import { getAccessToken } from '../lib/oauth-model'
6 6
7function authenticate (req: express.Request, res: express.Response, next: express.NextFunction, authenticateInQuery = false) { 7function authenticate (req: express.Request, res: express.Response, next: express.NextFunction, authenticateInQuery = false) {
8 const options = authenticateInQuery ? { allowBearerTokensInQueryString: true } : {} 8 const options = authenticateInQuery ? { allowBearerTokensInQueryString: true } : {}
@@ -24,7 +24,7 @@ function authenticate (req: express.Request, res: express.Response, next: expres
24} 24}
25 25
26function authenticateSocket (socket: Socket, next: (err?: any) => void) { 26function authenticateSocket (socket: Socket, next: (err?: any) => void) {
27 const accessToken = socket.handshake.query.accessToken 27 const accessToken = socket.handshake.query['accessToken']
28 28
29 logger.debug('Checking socket access token %s.', accessToken) 29 logger.debug('Checking socket access token %s.', accessToken)
30 30
@@ -38,7 +38,7 @@ function authenticateSocket (socket: Socket, next: (err?: any) => void) {
38 return next(new Error('Invalid access token.')) 38 return next(new Error('Invalid access token.'))
39 } 39 }
40 40
41 socket.handshake.query.user = tokenDB.User 41 socket.handshake.query['user'] = tokenDB.User
42 42
43 return next() 43 return next()
44 }) 44 })