1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-07 14:40:05 +00:00

chore: code fixes API + web

This commit is contained in:
Saad Jutt
2022-07-05 02:34:33 +05:00
parent 5338ffb211
commit 0b759a5594
7 changed files with 57 additions and 41 deletions

View File

@@ -5,7 +5,7 @@ import {
fetchLatestAutoExec,
ModeType,
verifyTokenInDB,
getAuthorizedRoutes
isAuthorizingRoute
} from '../utils'
import { desktopUser } from './desktop'
import { authorize } from './authorize'
@@ -21,9 +21,7 @@ export const authenticateAccessToken: RequestHandler = async (
return next()
}
const authorizedRoutes = getAuthorizedRoutes()
const uri = req.baseUrl + req.path
const nextFunction = authorizedRoutes.includes(uri)
const nextFunction = isAuthorizingRoute(req)
? () => authorize(req, res, next)
: next