handled error cases for external auth login

This commit is contained in:
Sheen Capadngan
2023-05-18 00:39:20 +08:00
parent 4b2e91da74
commit 6ca3b8ba61
4 changed files with 21 additions and 13 deletions
+11 -11
View File
@@ -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;
+1 -1
View File
@@ -106,7 +106,7 @@ const initializePassport = async () => {
req.providerAuthToken = providerAuthToken;
cb(null, profile);
} catch (err) {
cb(err);
cb(null, false);
}
}));
}