I am trying to use passport.js in my MEAN stack app for logging in the user. But I am confused about where do I use passport.js to authenticate the user.
Should I use it on the client side as in angular or else I should be using it in the express app and access profile information through the endpoints?
Thank you.
Passport.js is middleware that is used server-side with Node.js to implement authentication. You would use Angular (or Postman if you have no front-end yet) to access profile information stored in the database using API endpoints.
There is an excellent video series by Brad Traversy on Youtube that I went through this past weekend that goes over exactly what you're asking about: MEAN Stack Front to Back, where he builds a MEAN authentication app using passport.
Since the code was written 10 months ago, it was a little outdated, but I summarized all of the code-breaking changes in my github repo: https://github.com/Stanza987/mean-auth-app-universal. You can also see the finished product in action and download my source code if you so desire.