diff options
Diffstat (limited to 'server/middlewares/oauth.ts')
-rw-r--r-- | server/middlewares/oauth.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/server/middlewares/oauth.ts b/server/middlewares/oauth.ts index 1d193d467..2b4e300e4 100644 --- a/server/middlewares/oauth.ts +++ b/server/middlewares/oauth.ts | |||
@@ -1,7 +1,7 @@ | |||
1 | import * as express from 'express' | 1 | import * as express from 'express' |
2 | import * as OAuthServer from 'express-oauth-server' | 2 | import * as OAuthServer from 'express-oauth-server' |
3 | import 'express-validator' | 3 | import 'express-validator' |
4 | import { OAUTH_LIFETIME } from '../initializers' | 4 | import { OAUTH_LIFETIME } from '../initializers/constants' |
5 | import { logger } from '../helpers/logger' | 5 | import { logger } from '../helpers/logger' |
6 | import { Socket } from 'socket.io' | 6 | import { Socket } from 'socket.io' |
7 | import { getAccessToken } from '../lib/oauth-model' | 7 | import { getAccessToken } from '../lib/oauth-model' |
@@ -35,6 +35,8 @@ function authenticateSocket (socket: Socket, next: (err?: any) => void) { | |||
35 | 35 | ||
36 | logger.debug('Checking socket access token %s.', accessToken) | 36 | logger.debug('Checking socket access token %s.', accessToken) |
37 | 37 | ||
38 | if (!accessToken) return next(new Error('No access token provided')) | ||
39 | |||
38 | getAccessToken(accessToken) | 40 | getAccessToken(accessToken) |
39 | .then(tokenDB => { | 41 | .then(tokenDB => { |
40 | const now = new Date() | 42 | const now = new Date() |