From a3c8d456261184935e91954b03a0cd7762dfaeed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 21 Jul 2020 21:07:31 -0400 Subject: [PATCH] fix: crash if csrfToken does not exist --- src/routes/authentication.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/authentication.js b/src/routes/authentication.js index 1f26c23980..c2b238f7d5 100644 --- a/src/routes/authentication.js +++ b/src/routes/authentication.js @@ -67,7 +67,7 @@ Auth.reloadRoutes = async function (params) { loginStrategies.forEach(function (strategy) { if (strategy.url) { router.get(strategy.url, Auth.middleware.applyCSRF, function (req, res, next) { - req.session.ssoState = req.csrfToken(); + req.session.ssoState = req.csrfToken && req.csrfToken(); passport.authenticate(strategy.name, { scope: strategy.scope, prompt: strategy.prompt || undefined,