From 98374811f66cb305675cb22b771b686402ffd1db Mon Sep 17 00:00:00 2001 From: Anand Chowdhary Date: Tue, 25 Jun 2019 12:15:07 +0200 Subject: [PATCH] :bug: Redirect to frontend error page --- package.json | 2 +- src/controllers/auth.ts | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/package.json b/package.json index fb1975117..b532b387d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "staart", - "version": "1.0.40", + "version": "1.0.41", "main": "index.js", "repository": "git@github.com:AnandChowdhary/staart.git", "author": "Anand Chowdhary ", diff --git a/src/controllers/auth.ts b/src/controllers/auth.ts index 1dca71c58..542ffb6a0 100644 --- a/src/controllers/auth.ts +++ b/src/controllers/auth.ts @@ -245,13 +245,12 @@ export class AuthController { ); const service = req.params.service; const code = `${BASE_URL}/auth${req.path}?${stringify(req.query)}`; - if (service === "github") - return res.json(go(await githubCallback(code, res.locals))); + if (service === "github") return go(await githubCallback(code, res.locals)); if (service === "facebook") - return res.json(go(await facebookCallback(code, res.locals))); + return go(await facebookCallback(code, res.locals)); if (service === "salesforce") - return res.json(go(await salesforceCallback(code, res.locals))); - throw new Error(ErrorCode.NOT_FOUND); + return go(await salesforceCallback(code, res.locals)); + safeRedirect(req, res, `${FRONTEND_URL}/errors/oauth`); } @Get("oauth/github")