Node.Js Login and Registration with Database | Login, Logout and User Authentication | 1/2 |

แชร์
ฝัง
  • เผยแพร่เมื่อ 15 ก.ค. 2022
  • User authentication and login is the most important feature of many websites, and most likely a key component to your next project. In this video I will be covering absolutely everything you need to know about user login and authentication in the most concise and simple way. We will be using Express for our server backend and Passport to help us manage the logged in state of users. We will also be sure to properly encrypt and hash all user passwords so that our application is completely secure. By the end of this video you will have built a fully functional login system that you can use in any of your future projects.
    .
    Subscribe if you enjoyed this video for more amazing contents!!
    💻 Source Code
    👉github.com/desphixs/Node.Js-A...
    ___________________________
    💻 Django TH-cam Clone Tutorial - www.udemy.com/course/fullstac...
    ___________________________
    💻 Django TH-cam Clone Tutorial - www.udemy.com/course/create-a...
    🔗 Social Medias 🔗
    📱 Twitter: / desphixs
    📸 Instagram: / desphixs__
    ⭐ Discord: / discord
    📝 LinkedIn: / destiny-franks-18611120a
    🌎 Website: www.desphixs.com
    📂 GitHub: github.com/desphixs
    🔊 Podcast: Coming Soon
    💸 Donations 💸
    💵 One-Time Donations: paystack.com/pay/desphixs
    💰 Patreon: www.patreon.com/join/desphixs...
    ◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️◼️
    ------------------------------------------------ About Me --------------------------------------------
    My name is Destiny Franks, and I'm a Nigerian Web/Mobile App Developer. I truly enjoy coding, and since it's what I want to do in the long term, I decided to share my experience while teaching on TH-cam. So, via this channel, you'd learn programming, software engineering, machine learning, and everything IT. With a focus on Python and JavaScript, my channel seeks to provide you with free tools to help you learn to code and get started in the software engineering and programming business. My goal is to deliver the best programming and technology videos on the internet!

ความคิดเห็น • 109

  • @mattl2048
    @mattl2048 8 หลายเดือนก่อน +9

    I don't normally comment on videos but I've been searching for a video like yours. I'm only 24 minutes into the video and I can tell you're a natural teacher. You talk fast, but not too fast. Enough to keep the listeners attention and not have them steer off in boredom. You explain everything you're doing in detail. Very well done! I have not looked at your other videos, but I would love to see you combine React with this project! You've earned a subscriber for sure. Well done.

    • @desphixs
      @desphixs  6 หลายเดือนก่อน

      Thank you very much for your support

  • @nurhanisdamia7947
    @nurhanisdamia7947 ปีที่แล้ว +26

    you're the biggest contributor to my final year project, thank you so much for this!

    • @desphixs
      @desphixs  ปีที่แล้ว +2

      I'm happy to help ❤️

    • @alokdadhich4178
      @alokdadhich4178 ปีที่แล้ว +3

      no offence but.... this is my first year project i an not telling i am superior but i hate my self to chose such hard topic just spliting out my rage nothing else

  • @avian960
    @avian960 ปีที่แล้ว +8

    Thank you for this video, You explained everything very well.
    This tutorial is great, thought through and well paced.

    • @desphixs
      @desphixs  ปีที่แล้ว

      Thank you very much, I really do appreciate

  • @tboyszn
    @tboyszn 5 หลายเดือนก่อน +1

    I’m doing a project for school and was wondering if I can do this but implement a search bar to use an API for this?

  • @thecoolguyeli1464
    @thecoolguyeli1464 ปีที่แล้ว +3

    am so grateful i have been floating for days on understanding this. thumbs up

    • @desphixs
      @desphixs  ปีที่แล้ว

      Thanks alot buddy

  • @ojohnpepsi
    @ojohnpepsi 6 หลายเดือนก่อน +1

    Bro you make really good videos and I actually learned a lot from your vids. Keep it up dude!! You’ve earn a new subscriber 😁😁

    • @desphixs
      @desphixs  6 หลายเดือนก่อน +2

      Thank you my friend, I appreciate that.

  • @temidayoakinsola4935
    @temidayoakinsola4935 4 หลายเดือนก่อน

    Sir, I tried running the project using npm run devStart but it popped out an error saying: [nodemon] app crashed - waiting for file changes before starting... I would so glad if you could please help.

  • @RanjithRanjith-se5dp
    @RanjithRanjith-se5dp 5 หลายเดือนก่อน

    Have you used mongo db?

  • @GiftFranks-jc8yy
    @GiftFranks-jc8yy 4 หลายเดือนก่อน

    Great video blood ❤

  • @Alex-cs4hm
    @Alex-cs4hm 2 หลายเดือนก่อน

    very helpful! thank you very much

  • @svnbeats6700
    @svnbeats6700 3 หลายเดือนก่อน

    I been trying to do the same exact idea except i have a readExcel file to read my excel sheet in my stack but i keep getting stuck, when i run node server.js instead of showing me username: underfined but when i run node readExcel.js it reads it and i see the values for username and password. 😅i been battling this for the past 3 weeks lol i need help sos

  • @user-lk6kc4fl3j
    @user-lk6kc4fl3j 5 หลายเดือนก่อน

    where do i find part 2?

  • @bangcao85
    @bangcao85 ปีที่แล้ว +1

    Thanks for the tutorial. What is the chrome extension you used in the video for the auto name/email generator?

    • @desphixs
      @desphixs  ปีที่แล้ว

      You're welcome, the extension is called form filler

  • @younneschebli8609
    @younneschebli8609 ปีที่แล้ว +1

    You are amazing! Thanks man.

    • @desphixs
      @desphixs  ปีที่แล้ว

      Thanks a ton pal ❤️

  • @franciscodelafruitas9424
    @franciscodelafruitas9424 2 ปีที่แล้ว +3

    Excellente! Would love a tutorial on how you can require admin to approve registration before user can create an account and login?

    • @desphixs
      @desphixs  2 ปีที่แล้ว +2

      Okay sure, that would be done soon

  • @teamx9361
    @teamx9361 6 หลายเดือนก่อน

    what a video man brilliant keep it up bro ❤

    • @desphixs
      @desphixs  6 หลายเดือนก่อน +1

      Glad you enjoyed. Thanks a lot.

  • @TLOZ1986
    @TLOZ1986 ปีที่แล้ว +1

    Thank you for this Tutorial bro

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      Thanks alot ❤️

  • @croluy
    @croluy 25 วันที่ผ่านมา

    1:55
    That is bad, you shouldn't let the end user know if a specific email exists or not in your database. That can drastically simplify the process of hacking. Because instead of having to guess 2 fields (email AND pass) you cut that in half since you know that email is correct. You are giving extra info to the user which is unnecessary and doesn't serve any real purpose.
    Also, it would have been nice to also see that you have a "forgot password" button which lets you reset the password after you receive a specific email. That is very important for a decent login and registration form. It's not something which you can just avoid implementing and be cool with it.

  • @blazeco6617
    @blazeco6617 ปีที่แล้ว +2

    Hey do you mind helping me with how to connect the server to react? I have my front end login and registration page in react, IDK how to connect it to the server you made?

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      You need to write a rest API using node.js to do that, I'm making a tutorial on this. Dropping soon...

  • @sirhmvfx3496
    @sirhmvfx3496 ปีที่แล้ว +3

    🥺🥺🥺 Thank you so much for this.. I love the breakdown, the explanation it really helped.. Thank you so much ❤️❤️
    Please can you make a tutorial on REST API with CRUD OPERATIONS using the MVC Structure... Please 🥺

    • @desphixs
      @desphixs  ปีที่แล้ว +2

      Thanks alot , ❤️
      I'm working on that now

    • @sirhmvfx3496
      @sirhmvfx3496 ปีที่แล้ว

      Ohh okay... Thank you 🙇‍♂️🙇‍♂️🙇‍♂️... Please it should be NodeJs 🥺🥺

  • @letthegamebegin4306
    @letthegamebegin4306 ปีที่แล้ว +1

    its awesome man, but after submitting details & clicking on register, it is not showing the results in the console, i have checked the method is post, action is /register submit button type is submit.
    i dont what went wrong :( can you please help?

    • @desphixs
      @desphixs  ปีที่แล้ว

      Can you share your code?

  • @darrenjonathan3923
    @darrenjonathan3923 ปีที่แล้ว +1

    if im using postman to test the API, should i still make index.ejs like in your video?

    • @desphixs
      @desphixs  ปีที่แล้ว

      It's all upto you, if you need other users to make use of your application , then yes you need to create a frontend for users to interact with, if you're building only an API, then NO, you do not need to create the index.ejs.

  • @user-kp9es9ul2l
    @user-kp9es9ul2l ปีที่แล้ว +1

    Just Awesome
    Thanks

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      You're welcome

  • @xxdarkninjaxx6722
    @xxdarkninjaxx6722 ปีที่แล้ว +1

    dude ur awesome man

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      Thank you very much ♥️

  • @iyanuomozua
    @iyanuomozua ปีที่แล้ว +1

    How can I add my css to the Index.ejs
    And also my js files

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      You can add it in he public folder, look it up on google

  • @chepparmaps
    @chepparmaps ปีที่แล้ว +3

    Hello! Thanks so much for this tutorial. I appreciate your effort

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      You're welcome buddy, thanks for the comment I do appreciate it ❤️

  • @manasigiri1276
    @manasigiri1276 ปีที่แล้ว +1

    If i have js files and css files where do i put them ?

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      Put the js files in the place where css is staying

  • @_astroprogramming
    @_astroprogramming 2 ปีที่แล้ว +2

    pls have u finish the Instagram tutorial clone using Django.

    • @desphixs
      @desphixs  2 ปีที่แล้ว

      No I haven't, new episode coming tmr

  • @ShapeShifter13
    @ShapeShifter13 10 หลายเดือนก่อน +1

    Please I need your help. I followed your tutorial but got hooked in a particular place, need your help to get back on track

    • @desphixs
      @desphixs  10 หลายเดือนก่อน +1

      Where did you get hooked?

  • @user-nm4xr2ry1i
    @user-nm4xr2ry1i 10 หลายเดือนก่อน +1

    in which database the data is storing?....i.e login credentials

    • @desphixs
      @desphixs  10 หลายเดือนก่อน +1

      For now, we just used an array

  • @Sterlzever0
    @Sterlzever0 ปีที่แล้ว +1

    Where can I get the contination of this video? It not the full video

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      The full videos have been posted here on the channel

  • @carloslbb32521
    @carloslbb32521 ปีที่แล้ว +2

    Hey, what a beautiful video !! Im at 30:00 and when i hit the sign up button, nothing happens. What is the link between the sign up button (in the register.ejs) and the server ? I hope you can help me :) thanks

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      A couple of things might be happening.
      First, are you using a POST method?
      Secondly, where is your actions pointing too?
      Thirdly, what is type of button, submit??
      If all these are okay, then it'll be a server error.

    • @carloslbb32521
      @carloslbb32521 ปีที่แล้ว +1

      @@desphixs thanks for the reply, the problem was that i didnt use a . No its it and it works

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      Alright, kudos you fixed it.

  • @vikashkushwaha1114
    @vikashkushwaha1114 ปีที่แล้ว +1

    you can make a curd opretion in nodejs express nodejs

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      Sure, I'll do that as soon as possible.

  • @myayak20
    @myayak20 ปีที่แล้ว

    Hey thanks for the video
    I have a problem i already had html css and js file link to my html but now using the render of ejs files all the styling are lost it is like the css and the js files are not anymore connected to the my ejs files
    I have tried to look on stackoverflow and have seen some stuff related to app.use and express.static but I am still stuck can I have a help please

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      I'd be glad to help you with the issue you're facing with EJS, CSS, and JS files.
      When you switch from serving static HTML files to rendering EJS files using a server-side technology like Express, you need to make sure that your CSS and JS files are still accessible and linked correctly. Here's a step-by-step guide to resolving the issue:
      1. Set up Express and EJS:
      Make sure you have Express and EJS installed in your project. You can install them using npm if you haven't already:
      ``` Install express like we already did
      npm install express
      ```
      2. Set the view engine:
      In your Express app configuration, set EJS as the view engine:
      ```javascript
      const express = require('express');
      const app = express();
      app.set('view engine', 'ejs');
      ```
      3. Create a "views" folder:
      Create a folder named "views" at the root level of your project. Inside this folder, place your EJS files. For example, if you had an HTML file named "index.html", you would create a file called "index.ejs" inside the "views" folder.
      4. Link CSS and JS files in your EJS templates:
      In your EJS templates (e.g., index.ejs), link the CSS and JS files using the `express.static` middleware provided by Express.
      Assuming you have a folder named "public" where your CSS and JS files are located, add the following code to your Express app:
      ```javascript
      app.use(express.static('public'));
      ```
      This code tells Express to serve static files from the "public" folder, making them accessible to your EJS templates.
      In your EJS template (e.g., index.ejs), link your CSS and JS files like this:
      ```html
      My EJS Page

      ```
      Make sure to replace "styles.css" and "script.js" with the actual paths to your CSS and JS files.
      5. Start the server:
      Finally, start your Express server:
      ```javascript
      app.listen(3000, () => {
      console.log('Server is running on localhost:3000');
      });
      ```
      Now, your EJS templates should correctly link to the CSS and JS files, and the styling and interactivity should work as expected.
      Remember to check that your file paths and folder structure are correct. The "public" folder should contain your CSS and JS files, and the "views" folder should contain your EJS templates.
      If you've followed these steps and are still encountering issues, double-check the file paths and make sure your server is running correctly without any errors. If you can provide more details about the folder structure and the code you've implemented, I can help you further debug the problem.

    • @myayak20
      @myayak20 ปีที่แล้ว

      @@desphixs thank you it worked yesterday I found out about express.static

  • @clarencebuenaflor230
    @clarencebuenaflor230 ปีที่แล้ว +1

    I got stuck when you copy pasted the index.ejs file my terminal just shows errors like name not found etc…

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      Can you upload a screenshot shot of the error to imgbb and paste the image link here so I can see the error myself

    • @Honey_Bansal
      @Honey_Bansal ปีที่แล้ว

      I also got same error if your error is solved pls help me

  • @carldrogo9492
    @carldrogo9492 ปีที่แล้ว +1

    What database did you use?

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      I would be using a postgresl database, video dropping soon.

  • @Smurfis
    @Smurfis ปีที่แล้ว +1

    Hello brother, do you have a tutorial for this type of HTML and CSS page?

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      Not yet, but right now I'm making tutorial for html and css

    • @Smurfis
      @Smurfis ปีที่แล้ว

      @@desphixs Thank you, I look forward to seeing it the page looks very nice so far.
      It’s just I understand more when I visually build a entire project myself, then we could step by step dive into a more in-depth line by line comparison or I can do due diligence with AI to learn.
      Cheers again my brother!

  • @Glam-ReactWithTheja_Jith
    @Glam-ReactWithTheja_Jith ปีที่แล้ว +1

    Informative, can you please guide on how to connect to mysql. I am trying but data is not getting inserted to my database.

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      It'll be quite long, but hopefully it'll give you some idea on how to connect mysql with your application and save data to the db.
      1. Install the required dependencies:
      - Open your terminal or command prompt.
      - Navigate to your project directory.
      - Run the following command to install the `mysql` package:
      ```bash
      npm install mysql
      ```
      2. Import the `mysql` module and create a connection:
      - In your Node.js script, require the `mysql` module:
      ```javascript
      const mysql = require('mysql');
      ```
      - Create a connection to your MySQL database:
      ```javascript
      const connection = mysql.createConnection({
      host: 'localhost', // Replace with your MySQL host
      user: 'your_username', // Replace with your MySQL username
      password: 'your_password', // Replace with your MySQL password
      database: 'your_database' // Replace with your MySQL database name
      });
      ```
      3. Connect to the MySQL server:
      - Use the `connect` method of the connection object to establish a connection:
      ```javascript
      connection.connect((error) => {
      if (error) {
      console.error('Error connecting to MySQL database:', error);
      } else {
      console.log('Connected to MySQL database!');
      }
      });
      ```
      4. Perform database operations:
      - Once the connection is established, you can execute SQL queries to perform various operations.
      For example, to insert data into a table:
      ```javascript
      const data = { name: 'John', age: 30 }; // Example data
      connection.query('INSERT INTO your_table SET ?', data, (error, results) => {
      if (error) {
      console.error('Error inserting data:', error);
      } else {
      console.log('Data inserted successfully:', results);
      }
      });
      ```
      5. Close the database connection:
      - It's essential to close the database connection when you're done using it:
      ```javascript
      connection.end((error) => {
      if (error) {
      console.error('Error closing MySQL connection:', error);
      } else {
      console.log('MySQL connection closed successfully!');
      }
      });
      ```
      Make sure to replace the placeholder values (`localhost`, `your_username`, `your_password`, `your_database`, `your_table`) with the actual values specific to your MySQL database setup.
      By following these steps, you should be able to connect to your MySQL database using Node.js and perform database operations. Remember to handle errors appropriately and ensure the correctness of your SQL queries and data.

    • @Glam-ReactWithTheja_Jith
      @Glam-ReactWithTheja_Jith ปีที่แล้ว

      @@desphixs Thank you so much for your help🤝

  • @itsumair001
    @itsumair001 ปีที่แล้ว

    Everything have explained awesome but in passport I have confused little bit

    • @desphixs
      @desphixs  ปีที่แล้ว

      How can I help you? Just tell me the part that you don't understand using timestamp okay?

    • @itsumair001
      @itsumair001 ปีที่แล้ว

      @@desphixs it looking lengthy and confuseable why not to use jsonwebtoken ?

  • @Anonymous____________A721
    @Anonymous____________A721 10 หลายเดือนก่อน +2

    Tq sir

    • @desphixs
      @desphixs  10 หลายเดือนก่อน +1

      Welcome

  • @sunderamdubey3139
    @sunderamdubey3139 2 ปีที่แล้ว +2

    ❤️❤️❤️❤️

    • @desphixs
      @desphixs  2 ปีที่แล้ว +1

      Thanks brother ❤️🙂

  • @rahulbiswas1494
    @rahulbiswas1494 ปีที่แล้ว +2

    how can i add mongodb withi this ??

    • @desphixs
      @desphixs  ปีที่แล้ว

      I'll complete it soon with a DB connection

    • @samh4294
      @samh4294 ปีที่แล้ว

      @@desphixs will it be with mongodb atlas? I’d definitely appreciate it if it was a cloud storage

  • @tn_marshals
    @tn_marshals ปีที่แล้ว +1

    i can't get the source code please !

    • @desphixs
      @desphixs  ปีที่แล้ว

      Have you checked the repo?

  • @Bilo_7
    @Bilo_7 10 หลายเดือนก่อน +2

    Haha nice copy from Web dev simplified. But actually you explained it better ❤😊

    • @desphixs
      @desphixs  10 หลายเดือนก่อน +1

      Haha, it's was the first tutorials I took on node.js, so I thought; how about I teach what I learnt? In the future I'll make my own projects from scratch.

  • @zamora322
    @zamora322 ปีที่แล้ว +1

    No database connection 😢

    • @desphixs
      @desphixs  ปีที่แล้ว +2

      I'll complete the tutorial soon with a database connection

  • @StopGuardian
    @StopGuardian ปีที่แล้ว +1

    Can you show us how to connect this to a database like mongodb

    • @desphixs
      @desphixs  ปีที่แล้ว +2

      I'm making a video about that topic

  • @AkwetAfoh-on5ze
    @AkwetAfoh-on5ze ปีที่แล้ว +1

    Unable to subscribe

    • @desphixs
      @desphixs  ปีที่แล้ว

      How about now? where you later able to subscribe?

  • @beamboyz4901
    @beamboyz4901 10 หลายเดือนก่อน +1

    that it brother teach us the way evirrrrrreviiiirrrr coderrss

  • @3d4arab
    @3d4arab หลายเดือนก่อน +3

    in the title of the video you mentioned the word database, but after 21 minutes you decide to make it in a simple list , just for the simplicity, honestly i consider this cheating and misleading title 👎👎👎👎

    • @desphixs
      @desphixs  29 วันที่ผ่านมา

      My apologies, I would update the title to clearly convey what we’ll be doing in the tutorial.

  • @altairparis7863
    @altairparis7863 ปีที่แล้ว +2

    Plagiarism. There could be some plagiarism going on here. How come this code is very close to Kyles work: th-cam.com/video/Ud5xKCYQTjM/w-d-xo.html . Out of interest - who did the original work? Whoever did the work first deserves the monetisation and not the copier. Or did you both work on this together?

    • @desphixs
      @desphixs  ปีที่แล้ว +1

      This was the first node.js course I took, so I decided to make a tutorial explaining what I learnt in my own way.
      He is the original owner of the video, I just taught what I learnt in my own way.

  • @user-dd7kw3ym5i
    @user-dd7kw3ym5i ปีที่แล้ว

    did you copy this from webdevsimplified channel ☺

    • @desphixs
      @desphixs  ปีที่แล้ว +2

      Yes, That was my first node.js tutorial, so I had to teach what I learnt from the tutorial here 😅😅

    • @user-dd7kw3ym5i
      @user-dd7kw3ym5i ปีที่แล้ว +1

      @@desphixs ok , I have a question they say the ejs is not used anymore they say we can use like react.js as an alternative is that right?

    • @desphixs
      @desphixs  10 หลายเดือนก่อน +1

      Yes, that’s right; but you can still use ejs, it’s just not recommended again. Use react or angular instead

  • @exe.m1dn1ght
    @exe.m1dn1ght 11 หลายเดือนก่อน

    you didn't explain almost nothing, just telling us what to write and what options do we have .. dude, in a tutorial you need to explain what is happening and why it's happening, how do you expect a beginner to understand all of this ?

    • @desphixs
      @desphixs  11 หลายเดือนก่อน

      That was my first node.js tutorial, I've learnt alot in node.js since then and when I start making the next tutorials, there will be even be more better explanation