Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app.get(
- '/auth/trello_provider/callback',
- passport.authenticate('trello', { failureRedirect: '/unauth' }),
- (req, res) => res.redirect('/')
- );
- const ensureAuthenticatedForApiRequests = (req, res, next) => {
- if (req.isAuthenticated()) {
- return next();
- }
- return res.status(401).json({
- status: 'Unauthorized',
- statusCode: 401,
- message: 'You are not authorized. Go away!',
- });
- };
- app.get(
- '/api/contact/:contactId',
- ensureAuthenticatedForApiRequests,
- (req, res) => {
- // ...
- }
- );
- app.get('/route', passport.authenticate(['strategy1', 'strategy2'], (req, res) => {
- // ...
- });
Add Comment
Please, Sign In to add comment