Whitelisting routes
BilalHasanKhan opened this issue · comments
Bilal commented
Please pardon my ignorance but what's the best way in this to whitelist the routes which do not need authentication like say /register
Joshua Alpuerto commented
Hey @BilalHasanKhan
I assume you put the /register
route under user module.
You can follow this step
// comment the module level authentication
// router.use(auth.authenticate())
router
.get('/', auth.authenticate(), (req, res) => {
...
router
.get('/register', (req, res) => {
....
This way you can apply authentication per endpoint
.
Bilal commented
Many thanks for clarifying.