Created
December 24, 2021 13:08
-
-
Save duartefdias/8c0bd09d0fe1ec997c19711b4f68aee6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Test authenticated route | |
// Use this route to test if the front-end is able to access this route | |
// Front-end needs to pass the token in the request header (header name: "Authorization") | |
router.get('/authenticated/test', passport.authenticate('jwt', { session: false }), (req, res) => { | |
console.log('Authentication successful'); | |
res.json({ | |
message: 'Successfully authenticated', | |
user: req.user | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment