diff --git a/backend/src/routes/v1/oauth.ts b/backend/src/routes/v1/oauth.ts index fd2a5c803..d817e6467 100644 --- a/backend/src/routes/v1/oauth.ts +++ b/backend/src/routes/v1/oauth.ts @@ -5,18 +5,18 @@ import { oauthController } from '../../controllers/v1'; import { authLimiter } from '../../helpers/rateLimiter'; router.get( - '/redirect/google', - authLimiter, - passport.authenticate('google', { - scope: ['profile', 'email'], - session: false, - }), - ) - + '/redirect/google', + authLimiter, + passport.authenticate('google', { + scope: ['profile', 'email'], + session: false, + }), +) + router.get( - '/callback/google', - passport.authenticate('google', { failureRedirect: '/error', session: false }), - oauthController.handleAuthProviderCallback, + '/callback/google', + passport.authenticate('google', { failureRedirect: '/login/provider/error', session: false }), + oauthController.handleAuthProviderCallback, ) export default router; diff --git a/backend/src/utils/auth.ts b/backend/src/utils/auth.ts index 511c20d65..bde062b56 100644 --- a/backend/src/utils/auth.ts +++ b/backend/src/utils/auth.ts @@ -106,7 +106,7 @@ const initializePassport = async () => { req.providerAuthToken = providerAuthToken; cb(null, profile); } catch (err) { - cb(err); + cb(null, false); } })); } diff --git a/frontend/src/const.ts b/frontend/src/const.ts index 8d0044b2a..a16ca4232 100644 --- a/frontend/src/const.ts +++ b/frontend/src/const.ts @@ -17,7 +17,8 @@ export const publicPaths = [ `/subprocessors`, `/verify-email`, `/password-reset`, - `/login/provider/success` + `/login/provider/success`, + `/login/provider/error` ]; export const languageMap = { diff --git a/frontend/src/pages/login/provider/error.tsx b/frontend/src/pages/login/provider/error.tsx new file mode 100644 index 000000000..3f9a0fe0c --- /dev/null +++ b/frontend/src/pages/login/provider/error.tsx @@ -0,0 +1,7 @@ +export default function LoginProviderError() { + return ( +