Q42: How does Passport.js integrate with Express for social/OAuth authentication?

Difficulty:MediumTopic: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.user upon success.