I'm using a MEAN Stack based on a Yeoman generator and I'm trying to password protect my api endpoints.
I want to be able to use local and basic strategies on the same endpoint so I can call the API from external sources and use it in my webapp.
However when I implemented this, I can use only one strategy a time because the basic authentication is "stateless" which means that doesn't attach a session.
So far I got 2 different endpoints with 2 different strategies with this code:
router.get('/all-basic', passport.authenticate(['local','basic'],{ session: false }), controller.index);
router.get('/all-local', auth.isAuthenticated(), controller.index);
I want to know if there any other approach or best practices to try to use 2 strategies on the same endpoint, or I just need to call 2 different endpoints.
Thanks! Andres Osorio