]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/middlewares/oauth.ts
Fix lint
[github/Chocobozzz/PeerTube.git] / server / middlewares / oauth.ts
index 4ae7f18c2002e1182964c0c04fde29cfd5635cee..b1149174bfbf633c0ba7314718b997fa8f9ab451 100644 (file)
@@ -2,7 +2,7 @@ import * as express from 'express'
 import { logger } from '../helpers/logger'
 import { Socket } from 'socket.io'
 import { getAccessToken } from '../lib/oauth-model'
-import { handleIdAndPassLogin, oAuthServer } from '@server/lib/auth'
+import { oAuthServer } from '@server/lib/auth'
 
 function authenticate (req: express.Request, res: express.Response, next: express.NextFunction, authenticateInQuery = false) {
   const options = authenticateInQuery ? { allowBearerTokensInQueryString: true } : {}
@@ -48,7 +48,7 @@ function authenticateSocket (socket: Socket, next: (err?: any) => void) {
 function authenticatePromiseIfNeeded (req: express.Request, res: express.Response, authenticateInQuery = false) {
   return new Promise(resolve => {
     // Already authenticated? (or tried to)
-    if (res.locals.oauth && res.locals.oauth.token.User) return resolve()
+    if (res.locals.oauth?.token.User) return resolve()
 
     if (res.locals.authenticated === false) return res.sendStatus(401)