@@WebDevSimplified hes dumb. You’re not one of the best. You are the best. That’s not a question or something that everyone can see different. It’s a fuckin fact bro
4:47 tell express to use ejs view engine. 9:49 express url encoded to access data from HTML form. 12:03 bcrypt hash password from post /register. 17:01 use "strategy" for local version passport. 18:42 & 27:55 passport serializeUser & deserializeUser. 19:41 & 28:10 passport done function. 20:36 bcrypt compare hash to authenticate user. 22:45 app.use flash. 23:15 - 24:41 app.use session. 23:57 require dotenv config. 24:41 app.use passport initialize & session. 25:05 passport.authenticate middleware in post/login to redirect if the user is authenticated or not. 25:30 failureFlash to send the error messages to ejs. 25:46 display errors on ejs. 27:10 error fix: pass in authenticateUser to localStrategy. 29:20 get username from passport. 30:13 protect home route from not logged in users. 31:49 prevent already logged users from logged in. 33:27 set up log out route. 34:17 method-override allow delete verb for html. 34:58 method-override html form url/action string. 35:51 error fix: res.redirect.
@@urbaandesi Indeed -- different people have different needs, but the standard TH-cam "code tutorial" style is utterly weak. Every line is "what we're going to do is..." and "what we need to do is..." with no structured development of user knowledge. Practically the only structuring principle is "this is the order I type it in."
33:44 - Since passport version 0.6.0 (which was released only a few days ago by the time of writing this), req.logout is asynchronous. You will get the error: "req#logout requires a callback function." To fix it, all you need to do is replace this: app.delete('/logout', (req, res) => { req.logOut(); res.redirect('/login'); }); By this: app.delete('/logout', (req, res, next) => { req.logOut((err) => { if (err) { return next(err); } res.redirect('/login'); }); });
I was feeling learning javascript/node was an impossible thing for its very versatility. After 1 hour watching your video, feel so confident I can conquer it now. Thank you!
1:42 - Installing express, ejc 2:05 - Installing nodemon, dotenv 2:56 - Creating first script 11:10 - Installing bcrypt 14:39 - Installing passport, passport-local, express-session, express-flash 34:17 - Installing method-override PS: I wrote this comment just to remind myself of the times for each step in the video that was of interest to me, but as it has helped other people, it needs updates to be more complete. Anyone who can help, please reply to this comment. PS 2: For a more secure environment, if some user send his email or password wrong at login, just warn that one of both is wrong, but don't specify which one.
Even though it took me 2 viewings to understand passport, I loved how complete this tutorial was, while also only focusing on the core functionality without any fluff. Thank you so much, Kyle, for valuing the viewer's time. 😊
Thanks to Kyle for this tutorial. If recently you are watching this tutorial you might get and error: "req#logout requires a callback function," when you try to logout. This error occurs because the req.logout() function requires a callback function in more recent versions of passport. Here's how you can modify the app.delete('/logout', ...) route to include a callback function: app.delete('/logout', (req, res) => { req.logout((err) => { if (err) { return next(err); } res.redirect('/login'); }); });
I wish every programming tutorials channel would teach like this. Telling the end result and then explaining everything from 0 is the best way to understand how things work, and since we can follow the code and apply it right away, it also keeps me motivated to continue learning.
To tell the truth Kyle, 6 months ago when i was a noob, i could not understand your explanations. Now they are build mid level projects for company interviews, and I know some javascript, you are trully helpfull.
as a beginner took me some time to figure some things out, but finally completed this and got to learn a lot out of it. thanks for this amazing tutorial :)
i saw this tutorial a few days ago... i really struggled getting it.. i went crazy watching so many videos, reading stack overflow answers and so many days after, return to this and really quite got it all... for all those out there going nuts with this things, patience.. your actions will reward you, but you have to do the work
Love your channel, Kyle! I'm entering my second year in the industry and have only found a few good channels among the many rest. I love how you write and explain in the manner that the developing flows. It's like artistry... much like my beloved original trainer. I'll be binging and learning with you for a while, so thank you! 💖
Great Tutorial, thank you for all the help as always! Because of the new Session release, the 'req.logout' now requires a callback function for us to redirect the logout. See below for anyone that has the same problem; : app.delete('/logout', function(req, res) { req.logout(function(err) { if (err) { return next(err); } res.redirect('/login'); }); });
I don't know why this channel gets so little from its user!! You're amazing! THUMBS UP I am sharing this video to my Network. One more thing I have seen you using EJS lot of times!!! Could you please do some video in which you add react/vuejs in frontend!!
I have a discord server that you can join which is linked in the description of my newer videos. You can also follow me on Twitter or signup for the Learn React today email list.
Man, your channel is underrated. The contents are amazing and explained well. Ask in the beginning of every video for like, subscription and user engagement in the comment section. Keep the game going!
As a current coding camp student, I find this channel really essential to my understanding of NodeJS. The whole SET/GET/POST/USE thing was mush inside my head until I watch this video. And my class is working on a database project using Node & Express so I'm thinking I'll sign up for his course as well. Great job sir!
This is a tutorial what I need. Thank you so so much. And if anyone can't download npm bcrypt so can download npm bcriptjs and just replace const bcrypt = required("brciptjs')
You've saved me a lot of time because your tutorials are super simplified, I shared your video tutorials with my students and I encouraged them to learn web development from scratch, and your page has all we NEED. Thank you!
I wish I knew 90% of what you were showing. I know maybe 50%. I feel like there's a lot of knowledge I just don't know. Most people say "Ok. That's how that's done." My brain requires that I understand why each section does what it does or it won't absorb it. This instruction has helped some, but there are many sections where it's just copy me code. It's still much better than others. Thank you kindly for what you have created. =)
Thank you. I love that you are taking my tutorials and expanding upon them in your own projects. That is by far the best way to learn quickly, and the most fun in my opinion.
This content is excellent. You don't waste my time with fluff and it makes sense. I went from feeling unsure how to do node web dev to ready to build anything in just this one video. nice work!
I feel you should talk about how using express sessions in its default options would not scale in production. You need a session store like as a database, or things would most likely break in bigger applications.
Thanks a lot sir. There is not much I can do except liking and subscribing, but I hope this comment makes you understand how much I appreciate this video.
Hey, I watched this video year ago and now I am building a discird bot with an integrated website with login, register authentication and discord auth thank you very much for keeping on posting tutorial, This video is my stepping stone to start to be a full stack dev because I am a frontend dev and discord bot dev and noob at backend before, Also you helped a lot of people that are interested to build full stack app and do not know s to start.
FYI the function you use to logout the user now requires a callback function. app.delete('/logout', (req,res) => { req.logOut() res.redirect('/login') }) Doesn't work anymore and throws the error that it needs a callback function. app.delete("/logout", (req, res) => { req.logOut(function (err) { if (err) { return next(err); } res.redirect("/login"); }); }); Fixed it for me.
I love it! The clearest video about session and local passport. Not too much detail, but enough for us to debug and understand how it works! You are truly amazing and handsome, though I am a guy.
Error: req#logout requires a callback function. If you got this error in the end of tutorial that's because passport was changed since Kyle uploaded this video. Now req.logout is asynchronous. Can't rly post this code here but if you go to stack overflow you will find solution there. Just copy paste error title. As always, thx for upload Kyle!
Your lectures are the only ones I have ever slowed down lol. I love your videos and I know you will probably never see this but I wanted to take a moment to comment just to tell you how much I appreciate all of the content you have put out for free on youtube. I would have never been able to make it through my bootcamp without it.
In which format i have to provide data in const users = [ ].... I have provided in this format Const users = [ { id: 1, name: "s", email: "s@s", password: "s" } ] And i tried login using this email and password and that didn't worked.....can you please help me in which format i have to give detail.....
I'm not convinced passport saves much effort. The amount of boilerplate and dependencies it introduces. In the end writing my own jwt auth seems more streamlined but maybe I'm missing something?
passportjs also has support for logging in with other providers like google, facebook, twitter etc. The real value of passportjs comes from these actually. It is a lot of effort to integrate all these providers' login to the project. And i agree with you about the custom jws. If this is only what you need, it is ok.
Can anybody help me , I am using node.js along with postgresql database , And I don't know how to use passport in it , is all the procedures same as specified in the video , please help me !
I really did not enjoy this video as opposed to the JWT authentication one for example. I felt that you moved too fast through a lot of concepts when you started using the passport and passport-local modules. For example, what is a local strategy? It would've been nice if you'd explain the concepts a bit before starting to code
Amazing video dude :) I had to check twice that my video setting werent on 1.5x play because you are just so fast! Good pace though and well delivered. I am subbed for sure.
I saw your video on using jwt instead of sessions. If I want to use that, then should I still be using express-session? Could you perform a video that explains how to integrate passport and jwt?
No you don't need sessions for JWT. Jwt identifies user by checking jwt token in each request. While on session based passport strategies a cookie is checked on server side. You can also use passport-local without session but then it will need auth on every route and you need more work to identify user. In JWT auth server don't store any data about User. Token is saved on client side and server check for token in request.
I decided to use Node.js as my backend for some of my Android apps, but I was getting really tired of using Firebase as my auth service. I must say this video is exactly what I was looking for, thank you very much.
@@WebDevSimplified awesome. Just started learning node and I can't believe how much code it takes Just to Authenticate users.. ON FN REAL!! I actually heard php is easier for back-end maybe I should of went that route 😅 🤔
Yeah, I had some issue with bcrypt too, due to older Node.js version, but after I tried version from this version compatibility list, everything works just OK. www.npmjs.com/package/bcrypt
So I'm midway integrating the login system into my Mybrary website aka: - creating my own register and login routes and their models and views, - and was able to successfully save the user, email and bcrypted password to the local database server upon registration. So I know when I deploy it online, it'll be saved to the database online there too. Small question: That atlas database, is that available for everyone to see? I know I encrypted my password, but there may be lots of user information there and I don't want anyone to access that database just by link. Main question: In this video at 15:49 you install the passport local strategy for using logins locally. What strategy do I use so that I can deploy it online? I don't want to use a middleware like Facebook or Gmail logins, because the user already can register and it saves to the database, so what strategy do I use, in order to make possible what is currently possible with the passport-local strategy? Would syntax also be the same/similar, or do I have to find docs myself for that?Thanks in advance! :D
You've got to be kidding. He explained nothing. All he did was to read us his keystrokes as he typed them in. Did he explain why he installed the 'ejs' software, but then never bothered to use it by typing a 'require' statement for it ? No, he didn't. Did he explain how he could check for NODE_ENV === 'production' when NODE_ENV was never initialized to anything at all ? No, he didn't. Did he explain where he got this 'next' function from ? Or did he just grab it out of thin air ? No, he never mentioned that either. He acts like he was born with all of this information in his head, so he doesn't need to explain himself to anyone. Some tutorial.
Can you share the solution? I am stuck at exactly this. The code in this tutorial won't pull the email and password from a MongoDB db - everything is "undefined".
Been in covid lockdown for a couple of months now in SA. Loving your tutorials. I have watched most of them. Stunning. A lot of rewinding due to that freight-train brain of yours. One day, I might pull out my laptop and write my first bit of code at 62years old. At the moment just enjoying. Sincerely, ta for the great work.
Absolutely. Nobody gets to know in an instant what they have to do and in the exact order they have to do it. These tutorials have a lot of homework , revisions and errors going on backstage. It's perfectly fine to make errors!
Yes, you can. I bet Kyle makes a lot of errors, but that's normal for programmers. These tutorials are usually coded out beforehand, because who would like to sit here and watch Kyle making the idea and debugging ale things it would take at least 3 hours so you get the idea.
This tutorial was really good for the first half, up until the 16 minute mark. WTF is a session?? WTF Is a "strategy???" Wish these objects were explained in more depth. This is free so thank you for all of it though liked and subscribed
First you show what we're gonna do, then you teach how to get there. Excellent! This is one of my top 5 favorite dev channels.
Thank you!
What are the other four?
@@andersonl819
1)dev ed
2)programming with mosh(for intro to new tech)
3)telusko
4) Tech with tim
@@WebDevSimplified hes dumb. You’re not one of the best. You are the best. That’s not a question or something that everyone can see different. It’s a fuckin fact bro
@@santhosh3374 you missed traversy media 👍
I found this being one of the few rare tech channels where 0.75x speed works the best rather than 1.25x. Thanks man.
4:47 tell express to use ejs view engine.
9:49 express url encoded to access data from HTML form.
12:03 bcrypt hash password from post /register.
17:01 use "strategy" for local version passport.
18:42 & 27:55 passport serializeUser & deserializeUser.
19:41 & 28:10 passport done function.
20:36 bcrypt compare hash to authenticate user.
22:45 app.use flash.
23:15 - 24:41 app.use session.
23:57 require dotenv config.
24:41 app.use passport initialize & session.
25:05 passport.authenticate middleware in post/login to redirect if the user is authenticated or not.
25:30 failureFlash to send the error messages to ejs.
25:46 display errors on ejs.
27:10 error fix: pass in authenticateUser to localStrategy.
29:20 get username from passport.
30:13 protect home route from not logged in users.
31:49 prevent already logged users from logged in.
33:27 set up log out route.
34:17 method-override allow delete verb for html.
34:58 method-override html form url/action string.
35:51 error fix: res.redirect.
Thanks man
thank you, this was helpful🤩
Thank You
This is really helpful! Thank you.
So at 30:13 is he telling how to do the “AUTHORIZATION” part??
Finally someone that's straight to the point, without stopping 2 hours every time to explain EJS or some basic stuff. THANK YOU!
You're welcome! I try to balance my videos so that I only spend time explaining the specific topic that is being covered.
This.
His videos are awesome, but some people who are beginner they need 2 hours of long explanation.
Yeah, straight to the point !!!
@@urbaandesi Indeed -- different people have different needs, but the standard TH-cam "code tutorial" style is utterly weak. Every line is "what we're going to do is..." and "what we need to do is..." with no structured development of user knowledge. Practically the only structuring principle is "this is the order I type it in."
33:44 - Since passport version 0.6.0 (which was released only a few days ago by the time of writing this), req.logout is asynchronous.
You will get the error: "req#logout requires a callback function."
To fix it, all you need to do is replace this:
app.delete('/logout', (req, res) => {
req.logOut();
res.redirect('/login');
});
By this:
app.delete('/logout', (req, res, next) => {
req.logOut((err) => {
if (err) {
return next(err);
}
res.redirect('/login');
});
});
Thank you!
You are god
Thank you man!
Saved my life bro ...
thank you very much :)
I was feeling learning javascript/node was an impossible thing for its very versatility. After 1 hour watching your video, feel so confident I can conquer it now. Thank you!
1:42 - Installing express, ejc
2:05 - Installing nodemon, dotenv
2:56 - Creating first script
11:10 - Installing bcrypt
14:39 - Installing passport, passport-local, express-session, express-flash
34:17 - Installing method-override
PS: I wrote this comment just to remind myself of the times for each step in the video that was of interest to me, but as it has helped other people, it needs updates to be more complete. Anyone who can help, please reply to this comment.
PS 2: For a more secure environment, if some user send his email or password wrong at login, just warn that one of both is wrong, but don't specify which one.
34:17 - Installing method-override
@@minewarz Thanks.
HELP!!! Opps.. 27:08 where can i get this file ( strategy.js file ) ?
@@donkey_tube I don't remember much about this video. :/
Even though it took me 2 viewings to understand passport, I loved how complete this tutorial was, while also only focusing on the core functionality without any fluff. Thank you so much, Kyle, for valuing the viewer's time. 😊
!!This channel is seriously underrated!!
I mean your content is sooo 🔥🔥🔥
Thanks! I really appreciate it. Soon enough I will break into a larger audience but for now I am just a hidden gem 😜
@Xingming Pinyin yeah because he is pro bro
@@WebDevSimplified it will happen soon bro bcoz of ur rocking knowledge
@@WebDevSimplified i want your contact number or email.
@@WebDevSimplified Hi Webde, i am getting an error called: Error: Cannot find module 'dotenv' do you know how to fix it?
Yo im glad I bumped into this channel, best tutorials, strait to the point!
Thanks! I'm glad you found my videos and enjoy them.
@@WebDevSimplified thanks Mr i really enjoy ur videos they're so easy and really easy to understand
Thanks to Kyle for this tutorial. If recently you are watching this tutorial you might get and error: "req#logout requires a callback function," when you try to logout. This error occurs because the req.logout() function requires a callback function in more recent versions of passport. Here's how you can modify the app.delete('/logout', ...) route to include a callback function:
app.delete('/logout', (req, res) => {
req.logout((err) => {
if (err) {
return next(err);
}
res.redirect('/login');
});
});
I wish every programming tutorials channel would teach like this. Telling the end result and then explaining everything from 0 is the best way to understand how things work, and since we can follow the code and apply it right away, it also keeps me motivated to continue learning.
Absolutely no BS. straight to the point as always Kyle. Great work and a great channel to follow for the devs.
To tell the truth Kyle, 6 months ago when i was a noob, i could not understand your explanations. Now they are build mid level projects for company interviews, and I know some javascript, you are trully helpfull.
as a beginner took me some time to figure some things out, but finally completed this and got to learn a lot out of it. thanks for this amazing tutorial :)
i saw this tutorial a few days ago... i really struggled getting it.. i went crazy watching so many videos, reading stack overflow answers and so many days after, return to this and really quite got it all...
for all those out there going nuts with this things, patience.. your actions will reward you, but you have to do the work
Love your channel, Kyle! I'm entering my second year in the industry and have only found a few good channels among the many rest. I love how you write and explain in the manner that the developing flows. It's like artistry... much like my beloved original trainer. I'll be binging and learning with you for a while, so thank you! 💖
I just have switched from php to node js for 2 weeks. Your training is first class. Very helpful. THANK YOU VERY MUCH.
same! but i lost at passport stuff
Great Tutorial, thank you for all the help as always!
Because of the new Session release, the 'req.logout' now requires a callback function for us to redirect the logout.
See below for anyone that has the same problem;
: app.delete('/logout', function(req, res) {
req.logout(function(err) {
if (err) { return next(err); }
res.redirect('/login');
});
});
Thank you!
Hey I know this is really old but i get Cannot GET /loggout, anyone know what im doing wrong?
I love how you broke the problem down into its most simple form with your little demo website.
Thank you for keeping things simple!!!
I don't know why this channel gets so little from its user!!
You're amazing!
THUMBS UP I am sharing this video to my Network.
One more thing I have seen you using EJS lot of times!!!
Could you please do some video in which you add react/vuejs in frontend!!
Thank you! I am working on React videos for when I come back from vacation as well as a React course coming up soonish
@@WebDevSimplified Awesome !!! I'll be waiting for them in my TH-cam notification!!..
Is there a way to stay in touch with you!!
I have a discord server that you can join which is linked in the description of my newer videos. You can also follow me on Twitter or signup for the Learn React today email list.
This video is terrific. Lucid. Concise. To the point. Having watched maybe a dozen videos on passport, this is the best.
Man, your channel is underrated. The contents are amazing and explained well. Ask in the beginning of every video for like, subscription and user engagement in the comment section. Keep the game going!
Thanks! I have been asking people to subscribe in newer videos, but sometimes I forget.
As a current coding camp student, I find this channel really essential to my understanding of NodeJS. The whole SET/GET/POST/USE thing was mush inside my head until I watch this video. And my class is working on a database project using Node & Express so I'm thinking I'll sign up for his course as well. Great job sir!
This is a tutorial what I need. Thank you so so much.
And if anyone can't download npm bcrypt so can download npm bcriptjs and just replace
const bcrypt = required("brciptjs')
Like this:
npm i bcryptjs
and use it. const bcrypt = require('bcryptjs')
Thanks!
F:\333\Vanilla JS\passport-login_www>npm i bcryptjs
npm WARN passport-login_www@1.0.0 No description
npm WARN passport-login_www@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ bcryptjs@2.4.3
added 1 package from 6 contributors and audited 270 packages in 1.974s
still not working...
thanks dude!
tks dude!
All details in single shot without break. That's amazing.
All those missed semi-colons, got to love JS
Use a code formatter and they all get placed with a single click
You've saved me a lot of time because your tutorials are super simplified, I shared your video tutorials with my students and I encouraged them to learn web development from scratch, and your page has all we NEED. Thank you!
Woooooow, you're the best.. I will forever follow you. Thank you Sir. You made me know that, nothing is impossible..
Thank you! I'm really glad you enjoyed the video.
@@WebDevSimplified You're very welcome Sir.
I wish I knew 90% of what you were showing. I know maybe 50%. I feel like there's a lot of knowledge I just don't know. Most people say "Ok. That's how that's done." My brain requires that I understand why each section does what it does or it won't absorb it. This instruction has helped some, but there are many sections where it's just copy me code.
It's still much better than others.
Thank you kindly for what you have created. =)
Interesting tutorial! I'm going to use your example and see if I can use it for one of my own projects. Learned something new :-) Thanks a bunch!
Thank you. I love that you are taking my tutorials and expanding upon them in your own projects. That is by far the best way to learn quickly, and the most fun in my opinion.
I would buy all of this guy content. I bought his reactjs course to convert my vanilla js app to react. He explains things really well.
Thank you so much for the support!
I would suggest using *bcryptjs* instead of *bcrypt.* The API is the same but the dependencies are zero (and less problems).
This content is excellent. You don't waste my time with fluff and it makes sense. I went from feeling unsure how to do node web dev to ready to build anything in just this one video. nice work!
This is exactly what I was looking for - thank you Kyle 👌
You're welcome!
I think this is the first tutorial I've had to set to 0.75 to be able to follow along! Amazing stuff, great content, would definitely recommend!
hahah I did the same with the speed
I feel you should talk about how using express sessions in its default options would not scale in production. You need a session store like as a database, or things would most likely break in bigger applications.
did you watch the video? he says that this is not production. you need db
Finally I found my mentor for my upcoming 4 year journey✌
can you make a tutorial that also includes logging into a database?
Thanks a lot sir. There is not much I can do except liking and subscribing, but I hope this comment makes you understand how much I appreciate this video.
5:31
"Super simple server setup"
It's like the 'supercalifragilisticexpialidocious' in Marry Poppings.
😂
Hey, I watched this video year ago and now I am building a discird bot with an integrated website with login, register authentication and discord auth thank you very much for keeping on posting tutorial, This video is my stepping stone to start to be a full stack dev because I am a frontend dev and discord bot dev and noob at backend before, Also you helped a lot of people that are interested to build full stack app and do not know s to start.
FYI the function you use to logout the user now requires a callback function.
app.delete('/logout', (req,res) => {
req.logOut()
res.redirect('/login')
})
Doesn't work anymore and throws the error that it needs a callback function.
app.delete("/logout", (req, res) => {
req.logOut(function (err) {
if (err) {
return next(err);
}
res.redirect("/login");
});
});
Fixed it for me.
Thanks!
I'm impressed at how calmly you manage to respond to an error, and how easily and calmly you point it out and fix it.
Really nice tutorial. Thanks for helping me to clear my concepts :-)
I'm glad I could help!
I love it! The clearest video about session and local passport. Not too much detail, but enough for us to debug and understand how it works! You are truly amazing and handsome, though I am a guy.
We would say in German: Ehrenmann 💪
Most of my node js knowledge is owed to you. You don’t know how many jams you’ve gotten me out of. Legend!!
Error: req#logout requires a callback function. If you got this error in the end of tutorial that's because passport was changed since Kyle uploaded this video. Now req.logout is asynchronous. Can't rly post this code here but if you go to stack overflow you will find solution there. Just copy paste error title.
As always, thx for upload Kyle!
th-cam.com/video/c6zI1gCaO-c/w-d-xo.htmlsi=54fx_itohSqkmJEX&t=907
Your lectures are the only ones I have ever slowed down lol. I love your videos and I know you will probably never see this but I wanted to take a moment to comment just to tell you how much I appreciate all of the content you have put out for free on youtube. I would have never been able to make it through my bootcamp without it.
In which format i have to provide data in const users = [ ]....
I have provided in this format
Const users = [ {
id: 1,
name: "s",
email: "s@s",
password: "s"
} ] And i tried login using this email and password and that didn't worked.....can you please help me in which format i have to give detail.....
Users is an array of objects and your presentation looks correct. I think you might be having an error with something else🤔
Gonna need this very soon thanks.
Edit: I'd love to learn HTML Canvas too
HTML Canvas is something I also want to learn more about. It is really useful for doing things like game development.
After watching this tutorial only for 5 minutes i realize that you are a awesome developer as well as teacher !!!!!!
Thank you so much!
I'm not convinced passport saves much effort. The amount of boilerplate and dependencies it introduces. In the end writing my own jwt auth seems more streamlined but maybe I'm missing something?
passportjs also has support for logging in with other providers like google, facebook, twitter etc. The real value of passportjs comes from these actually. It is a lot of effort to integrate all these providers' login to the project. And i agree with you about the custom jws. If this is only what you need, it is ok.
Can anybody help me , I am using node.js along with postgresql database , And I don't know how to use passport in it , is all the procedures same as specified in the video , please help me !
Hi Kyle, just wanted to thank you for putting so much energy and accuracy into your work. Lovely to watch and listen to.
This guy's face is brighter than my future !!
after 1 year this video help me to create a login & register system for my socket.io app that I learned form u too ur just a legend
I really did not enjoy this video as opposed to the JWT authentication one for example. I felt that you moved too fast through a lot of concepts when you started using the passport and passport-local modules. For example, what is a local strategy? It would've been nice if you'd explain the concepts a bit before starting to code
www.passportjs.org/packages/passport-local/
Anyone wandering passport local is username password login
Amazing video dude :) I had to check twice that my video setting werent on 1.5x play because you are just so fast! Good pace though and well delivered. I am subbed for sure.
This is exactly what I needed, but because he isn't storing the information to a DB, it makes it a little difficult to implement.
I am trying very hard to use this code and connect it with mongo db but till now I cannot do it.
Like he said, watch his video on connecting databases. Then come back to this video. It should be easier then.
U r very clear with concepts man. U just know where is error and everything. Keep making tutorials. Good luck!
Thanks!
I saw your video on using jwt instead of sessions. If I want to use that, then should I still be using express-session? Could you perform a video that explains how to integrate passport and jwt?
That's my question too. Do u solved it?
No you don't need sessions for JWT. Jwt identifies user by checking jwt token in each request. While on session based passport strategies a cookie is checked on server side.
You can also use passport-local without session but then it will need auth on every route and you need more work to identify user.
In JWT auth server don't store any data about User. Token is saved on client side and server check for token in request.
I decided to use Node.js as my backend for some of my Android apps, but I was getting really tired of using Firebase as my auth service. I must say this video is exactly what I was looking for, thank you very much.
You are very welcome! I'm glad I could help.
Try "app.set('view engine', 'ejs')" if it doesn't work with the hyphen.
Bro why do all these Dev's Do such a great job on these tutorials! Keep up the great work!
That is exactly what we are doing
@@WebDevSimplified awesome. Just started learning node and I can't believe how much code it takes Just to Authenticate users.. ON FN REAL!! I actually heard php is easier for back-end maybe I should of went that route 😅 🤔
Hey this video is great! It has helped my understanding greatly, could you do a role based authentication video using mongodb? Thanks very much
hello sir, looking for the same. PLS drop down a link if u got one :)
+1
Thank you for doing this. You cannot believe how many people you are helping!
If you already have a login form setup with html and css, how would you get that to work instead of using ejs
just watch this video ( th-cam.com/video/vcWsOxmHlpg/w-d-xo.html ) u will understand everything.
It's not big deal
Hai. Very clear explanation about jwt. I saw many other videos about jwt.but your video cleared all my doubt about jwt.thank you bro.
I thought we were making a passport airport login registration portal🤣
Once again...best channel for web development....just as the name indicates.. simplify the web....thanks for the content...
this makes me the good kind of confused
This is the cleanest code walkthrough I've ever seen.
This is basically an audio version of documentations.. Not explaining any concept at all, just reading like a robot..
u helped me so much! i have a deadline today on authentication. your video literally saved me from failure
if someone has problem with "npm i bcrypt" use "npm i bcryptjs" instead
Pretty sure that its slower than bcrypt tho
I only suscribe to this channel because the developer is like a hollywood actor. More programmers like you!
If you got error when you install bcrypt you can use downgrade version via 'npm i bcrypt@3.0.6'
Yeah, I had some issue with bcrypt too, due to older Node.js version, but after I tried version from this version compatibility list, everything works just OK. www.npmjs.com/package/bcrypt
Yup, had the same issue! Thanks a bunch!
Man! Seriously you're seriously super-duper. My number #1 channel is yours. Keep up man. Thanks.
So I'm midway integrating the login system into my Mybrary website aka:
- creating my own register and login routes and their models and views,
- and was able to successfully save the user, email and bcrypted password to the local database server upon registration.
So I know when I deploy it online, it'll be saved to the database online there too.
Small question:
That atlas database, is that available for everyone to see? I know I encrypted my password, but there may be lots of user information there and I don't want anyone to access that database just by link.
Main question:
In this video at 15:49 you install the passport local strategy for using logins locally. What strategy do I use so that I can deploy it online? I don't want to use a middleware like Facebook or Gmail logins, because the user already can register and it saves to the database, so what strategy do I use, in order to make possible what is currently possible with the passport-local strategy? Would syntax also be the same/similar, or do I have to find docs myself for that?Thanks in advance! :D
He explains it so well you can still learn just by seeing and hearing
You've got to be kidding. He explained nothing. All he did was to read us his keystrokes as he typed them in. Did he explain why he installed the 'ejs' software, but then never bothered to use it by typing a 'require' statement for it ? No, he didn't. Did he explain how he could check for NODE_ENV === 'production' when NODE_ENV was never initialized to anything at all ? No, he didn't. Did he explain where he got this 'next' function from ? Or did he just grab it out of thin air ? No, he never mentioned that either. He acts like he was born with all of this information in his head, so he doesn't need to explain himself to anyone. Some tutorial.
@@p0o9i8z He has explained this is many of his videos. This is not for someone who justs wants to jump into node.
This was super helpful! If anyone in the comments knows how I could swap the users array for a database in mongodb i would appreciate any info!
I have figured it out
@@wackodreamer Can you share your solution? I am looking to do the same thing.
@@scottregb Me too. Please.
Can you share the solution? I am stuck at exactly this. The code in this tutorial won't pull the email and password from a MongoDB db - everything is "undefined".
this is really simplified, actually Im appending this login page in the previous node express project that you taught
thanks!!
Thanks for the video. I keep getting Error: Unknown authentication strategy "local"
Been in covid lockdown for a couple of months now in SA.
Loving your tutorials. I have watched most of them. Stunning.
A lot of rewinding due to that freight-train brain of yours.
One day, I might pull out my laptop and write my first bit of code at 62years old.
At the moment just enjoying. Sincerely, ta for the great work.
I am really glad you are finding something enjoyable to do during lockdown! Good luck on your first bit of code. It gets addicting after you start.
why don't we use the built-in crypto instead of bcrypt
bcrypt is the better choice if you want to hash passwords. it's much easier for an attacker to 'reverse' a 'hash' on 'native-crypt'.
This man is elite. Thank you for taking the time to carefully explain each step.
Hey i tried doing the same thing with my Mongodb but im getting error "cannot read property email of null" what should i do??
Express has changed how it does body parsing you now need github.com/expressjs/body-parser to use req.body
Thank you . Without your course, maybe I will spend 3 days building such a login pages.
But now , it only cost 36 minutes !! cool
Can you help to debug this error on my console = express-session deprecated req.secret; provide secret option server.js :22:9
Passport js was tough to learn. Used tons of resources, but that video was my main help. Thanks a lot!🙏
Can you still be a web developer if your brain doesn't work half as fast as this guy?
Absolutely. Nobody gets to know in an instant what they have to do and in the exact order they have to do it. These tutorials have a lot of homework , revisions and errors going on backstage. It's perfectly fine to make errors!
Yes, you can. I bet Kyle makes a lot of errors, but that's normal for programmers. These tutorials are usually coded out beforehand, because who would like to sit here and watch Kyle making the idea and debugging ale things it would take at least 3 hours so you get the idea.
I don’t usually comment on TH-cam videos but I need to say that you are an amazing teacher. I watch every single video! Congrats 👏
This TH-cam channel is a goldmine!
The tutorial: 40min
My working time: 3h
Definitely takes time to soak in the info and implement it on your own project. The important part is understanding it. :)
Lol, i know right.
lol took me about 17 hours, but in my fairness, I completely edited the code to fit my needs which were quite strict.
Well , the youtuber speaks in like 1.5x speed lol
Thank you man. Got to learn in a very straight forward way and it was exactly what I wanted. Nothing less and nothing overburdeningly more.
I make the user's data connected with mongodb.
see it here: github.com/Ilham-Nugroho/login-passport-mongodb
Brilliant, thanks. I spent half a day identifying the error and then trying to fix it. This did it!
Thanks mate
Thank you!
This tutorial was really good for the first half, up until the 16 minute mark. WTF is a session?? WTF Is a "strategy???" Wish these objects were explained in more depth. This is free so thank you for all of it though liked and subscribed
11:20 my man said "ternimal"
Learned more during this video than I have in the last 12 weeks, thank you! 😅
Playback speed = 0.25
absolutly!!!!!