Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript User Authentication With Express and Mongo Sessions and Cookies Authenticating the Username and Password

Is this the standard method to add the authentication on express with mongoose?

I cannot find any references, documentation, or articles on how to create the authentication functionality this way meaning that you create the method on UserShema that does authentication. During watching the video, I stopped it so that I could attempt before Dave going through the lesson. I basically used bcrypt.compare in index.js, pretty intuitive, I think. I know the object-oriented programming way is more elegant, but the problem is that I cannot find any written articles to implement the authentication, so I don't know if the Dave did is the typical standard way or just works for this particular application.

1 Answer

Sylwester Guzek
Sylwester Guzek
16,088 Points

you can refer to http://www.passportjs.org/ which supports session and many other more advanced authentications