X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fmiddlewares%2Fauth.ts;h=e6025c8ce273bf60a13d20c09e118dd65cd91ec4;hb=43dd28772a10daba5488be4bd700b24469c153b0;hp=ad3b24ab21c27a1147aa3ca59ce8db56154f02c1;hpb=4e56f0fff12ab9840574e7a27277fc78b195b3e2;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/middlewares/auth.ts b/server/middlewares/auth.ts index ad3b24ab2..e6025c8ce 100644 --- a/server/middlewares/auth.ts +++ b/server/middlewares/auth.ts @@ -5,8 +5,8 @@ import { HttpStatusCode } from '../../shared/models/http/http-error-codes' import { logger } from '../helpers/logger' import { handleOAuthAuthenticate } from '../lib/auth/oauth' -function authenticate (req: express.Request, res: express.Response, next: express.NextFunction, authenticateInQuery = false) { - handleOAuthAuthenticate(req, res, authenticateInQuery) +function authenticate (req: express.Request, res: express.Response, next: express.NextFunction) { + handleOAuthAuthenticate(req, res) .then((token: any) => { res.locals.oauth = { token } res.locals.authenticated = true @@ -14,7 +14,7 @@ function authenticate (req: express.Request, res: express.Response, next: expres return next() }) .catch(err => { - logger.warn('Cannot authenticate.', { err }) + logger.info('Cannot authenticate.', { err }) return res.fail({ status: err.status, @@ -47,7 +47,7 @@ function authenticateSocket (socket: Socket, next: (err?: any) => void) { .catch(err => logger.error('Cannot get access token.', { err })) } -function authenticatePromise (req: express.Request, res: express.Response, authenticateInQuery = false) { +function authenticatePromise (req: express.Request, res: express.Response) { return new Promise(resolve => { // Already authenticated? (or tried to) if (res.locals.oauth?.token.User) return resolve() @@ -59,7 +59,7 @@ function authenticatePromise (req: express.Request, res: express.Response, authe }) } - authenticate(req, res, () => resolve(), authenticateInQuery) + authenticate(req, res, () => resolve()) }) }