From ff7985ad7d214cd2c7b5c2341aaa878edc826d20 Mon Sep 17 00:00:00 2001 From: Diego Magdaleno Date: Sat, 22 May 2021 18:51:46 -0500 Subject: Config: Final config additons, now everything should work as desired --- src/middlewares/Authentication.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/middlewares/Authentication.ts') diff --git a/src/middlewares/Authentication.ts b/src/middlewares/Authentication.ts index 0ecc1bc0..78533489 100644 --- a/src/middlewares/Authentication.ts +++ b/src/middlewares/Authentication.ts @@ -1,6 +1,7 @@ import { NextFunction, Request, Response } from "express"; import { HTTPError } from "lambert-server"; import { checkToken } from "@fosscord/server-util"; +import * as Config from "../util/Config" export const NO_AUTHORIZATION_ROUTES = [ "/api/v8/auth/login", @@ -27,7 +28,10 @@ export async function Authentication(req: Request, res: Response, next: NextFunc // TODO: check if user is banned/token expired try { - const decoded: any = await checkToken(req.headers.authorization); + + const { jwtSecret } = (Config.apiConfig.getAll() as Config.DefaultOptions).security; + + const decoded: any = await checkToken(req.headers.authorization, jwtSecret); req.token = decoded; req.user_id = decoded.id; -- cgit 1.5.1