Q42: How does Passport.js integrate with Express for social/OAuth authentication?
passport is an authentication middleware framework for Node.js. It uses modular plugins called 'Strategies' (e.g., passport-local, passport-jwt, passport-google-oauth20) to authenticate requests.
Key Takeaways
- Encapsulates authentication strategies (OAuth, Local, JWT) behind unified middleware functions.
- Attaches authenticated user payloads directly to
req.userupon success.