🔐 Learn How to Create a Secure Website with User Authentication using the MERN Stack! | Tutorial

Поділитися
Вставка
  • Опубліковано 12 лис 2024

КОМЕНТАРІ • 71

  • @alchemist2579
    @alchemist2579 5 місяців тому

    There are so many comments that has already explained how great and rich this tutorial is and I'm adding on to them as I have watched the entire video and tried it out for myself.... this is by far the best tutorial that is rightly paced with explanation of every details that a beginner might look for . I had watched so many videos but they didn't help me to this extent . Sincerely, I thank you from the bottom of my heart !!!

    • @AlanCodes
      @AlanCodes  5 місяців тому +1

      @ruepic289 Thank you so much for the kind words! That really means a lot. I am super happy to hear that this video helped you tons! 🙂

  • @agntomega7220
    @agntomega7220 6 місяців тому

    I have seen many videos but they didn't teach us the last part of account section but now I understand the account section part with token and local storage thank you for creating this wonderful tutorial for us it really helped me a lot in understanding the MERN AUTH now I can easily implement this in all my projects ♥♥♥

    • @AlanCodes
      @AlanCodes  6 місяців тому

      @agntomega7220 I am sooo happy to hear that! Certain parts of MERN are a bit tricky to understand at first but once you get it, the possibilities for different projects are endless! Thank you so much for your awesome comment!! 😊

  • @kumar_sanjeevdutta1069
    @kumar_sanjeevdutta1069 Рік тому +4

    Sweet and simple, thanks, I was not able to protect my page now I will try your technique

    • @kumar_sanjeevdutta1069
      @kumar_sanjeevdutta1069 Рік тому

      You know what, it worked, really grateful to you, thanks, and if possible, please make a small mern project including redux, just core not readux thunk ❤❤❤❤

  • @sunithab2704
    @sunithab2704 11 місяців тому +5

    On point tutorial. Thanks for explaining every step in detail

    • @opsingh861
      @opsingh861 7 місяців тому

      he implemented secured routing in it???

  • @bereketg5609
    @bereketg5609 5 місяців тому

    This is not only authentication tutorial but also express😊 thanks man you explained everything

    • @AlanCodes
      @AlanCodes  5 місяців тому

      @bereketg5609 Thank you!!! 😊

  • @BhanuPrakash-ql7qf
    @BhanuPrakash-ql7qf 6 місяців тому

    I saw lot of mern authentication videos but ur explanation video is very clear to understand... thanks a lot😊

  • @clairebayoda8325
    @clairebayoda8325 Місяць тому

    Thank you so much for this wonderful content, Alan! Looking forward for more content from you! 🙏

    • @AlanCodes
      @AlanCodes  Місяць тому

      @clairebayoda8325 I really appreciate it! Thank you! I will try to get more out soon! 🙂

  • @manojk-r2p
    @manojk-r2p 6 місяців тому

    thank you bro i watch numerber of vedios but your vedios gives me very clear cut pxplanation even though i dont know thamil im am from telugu state

  • @the-boss-98
    @the-boss-98 10 місяців тому

    Better than most paid courses out there!

    • @AlanCodes
      @AlanCodes  10 місяців тому

      @the-boss-98 Thank you so much! I really really appreciate it! 😊

  • @byronloarte
    @byronloarte Рік тому +1

    Excellent video my dear friend

    • @AlanCodes
      @AlanCodes  Рік тому +1

      @byronloarte973 Thank you! I really appreciate the feedback!

  • @mjylove2
    @mjylove2 3 місяці тому

    Amazing ! Really loved the video!👍

    • @AlanCodes
      @AlanCodes  3 місяці тому

      @mjylove2 I am thrilled! Thank you so much!! 😊

  • @pramitsrivastava2579
    @pramitsrivastava2579 Рік тому +1

    bro thank you so much for making a video in such an detailed manner I was struggling in how to authenticate the user but after watching this video I understood that how it's done .

    • @AlanCodes
      @AlanCodes  Рік тому

      @pramitsrivastava2579 I'm super glad to hear that!! 🙂 You got this! Now that you understand how it's done, keep building that muscle memory, and everything else will be so much easier 🙌🏼

  • @azhara.2143
    @azhara.2143 Рік тому

    Thank you, let's go learn MERN stack

  • @majjisobhamadhuri9140
    @majjisobhamadhuri9140 Рік тому

    Thank you so much I have seen so many vedios but I am not getting perfectly but this tutorial helps me a lot and got the exact output...kudoos to ur work😊

    • @AlanCodes
      @AlanCodes  Рік тому

      @majjisobhamadhuri9140 I'm happy to hear that! And thank you! That's definitely why I decided to make videos. Keep at it! 😊

  • @kronos7455
    @kronos7455 8 місяців тому

    great way of explaining thing and making project .keep it up bro.create a movie rating app or food order app

  • @KarthikVijay-m6t
    @KarthikVijay-m6t 9 місяців тому

    do this method work in hosting platforms like vercel as i think localstorage wont work there

  • @alihassanhaji2830
    @alihassanhaji2830 Рік тому +2

    This is the kind of videos we need in MERN stack, Thanks brother fr the big effort, I would you to add the implementation of password reset and nodemailer 🙏🙏🙏

    • @AlanCodes
      @AlanCodes  Рік тому +1

      @alihassanhaji2830 thank you so much!! My pleasure! Those were definitely some ideas I had for upcoming videos! 🙂

  • @Joey-Jets
    @Joey-Jets 11 місяців тому

    Really great tutorial. Btw what theme are you using, looks clean.

    • @AlanCodes
      @AlanCodes  11 місяців тому

      @mojo382 Thank you so much! The theme I'm using is Monokai Pro Filter Spectrum

  • @kronos7455
    @kronos7455 8 місяців тому

    I have one issue,when I sign out it directly leads to a blank white page

  • @MUSE859
    @MUSE859 Рік тому +1

    awesome tutorial thanks🙏

  • @tarunlanka740
    @tarunlanka740 7 місяців тому

    Sir what to do if get "Error signing up " in postman

    • @AlanCodes
      @AlanCodes  7 місяців тому

      Hey @tarunlanka740 ! If your are receiving that 500 "Error signing up" error code, somethings you might want to double check are.
      1- Making sure the connection to your mongoDB is successful
      2 - Checking if the permissions in MongoDB allow you to readWriteAnyDatabase
      3- Double check your HandleRegister function to make sure the endpoint for the submitted form is being sent to /register
      4- In Postman, when you make a POST request to localhost:3001/register, make sure the "Body" tab is clicked, then "raw", then choose "json" and use format:
      {
      "email": "json@json.com",
      "username": "json",
      "password": "password"
      }
      Hope this helps!!

  • @starX7995
    @starX7995 Рік тому

    really good for beginners bro❤‍🔥

  • @captainash4714
    @captainash4714 Рік тому

    Why at 51.02 we are comparing all the bycrypt passwords to that one user password , We were supposed to compare bycrypt password of that user with the original password of that user only?

    • @bhat_hazim
      @bhat_hazim Рік тому

      We are comparing the password that has been recieved from body to the password that is being stored in db

  • @ravindueshan2786
    @ravindueshan2786 10 місяців тому

    Thank you so much

  • @captain_11155
    @captain_11155 Рік тому +1

    Hello bro thanks, but if user login and token will expire then how to protect the account then i mean there is always token in local storage until i clicked on signout. Please can u tell me how to protect or redirect users to login if token expired.

    • @AlanCodes
      @AlanCodes  Рік тому +1

      @captain_11155 Hey! Thats a very good question! I don't have physical code, but one thing you can try is in the app.js file, make a function that helps check if the token is expired, then you can add it inside of the protected route logic (inside the curly brackets). you can try putting it in here {isUserSignedIn && }. Make sure to change up the code. Hope this helps!

    • @captain_11155
      @captain_11155 Рік тому

      @@AlanCodes ya I did already after punching the head to the code 🤯😅 but anyway thanks 👍

  • @curtiss5982
    @curtiss5982 Рік тому

    Great Video Man👏👏👏

    • @AlanCodes
      @AlanCodes  Рік тому

      @curtiss5982 Thank you so much! I really appreciate it! 🙏🏼

  • @baraiyasachin9166
    @baraiyasachin9166 7 місяців тому

    love from india 💗

    • @AlanCodes
      @AlanCodes  7 місяців тому

      @baraiyasachin9166 Thank You!!!

  • @valenciawalker6498
    @valenciawalker6498 6 місяців тому

    Thank you

  • @ruqayahn.k4645
    @ruqayahn.k4645 11 місяців тому

    thank you very mach , very useful 🌹❤

    • @AlanCodes
      @AlanCodes  11 місяців тому

      Im super glad! 🙂

  • @lucifer_bois
    @lucifer_bois 10 місяців тому +1

    Great❤🎉🎉

  • @rashidshahriar7913
    @rashidshahriar7913 Рік тому

    please create role based login system with mern stack

  • @Pransshhh
    @Pransshhh Рік тому

    Very good work Sir. Thank you. Please teach us how to use auth0 in next video

    • @AlanCodes
      @AlanCodes  Рік тому

      @pranshuverma1645 Thank you! I'm not too familiar with auth0 but when I do get more familiarized with it , i'll def make a video!

    • @Pransshhh
      @Pransshhh Рік тому

      @@AlanCodes Sure Sir

  • @ravindueshan2786
    @ravindueshan2786 10 місяців тому +1

    (node:28800) [MONGODB DRIVER] Warning: useUnifiedTopology is a deprecated option: useUnifiedTopology has no effect since Node.js Driver version 4.0.0 and will be removed in the next major version
    (Use `node --trace-warnings ...` to show where the warning was created)
    node:events:492
    throw er; // Unhandled 'error' event
    ^
    how can i fix this error

    • @MARENO-vy4cx
      @MARENO-vy4cx 9 місяців тому

      i am also getting the same error. did u rectify it? if yes, tell me how did u do it?

    • @ravindueshan2786
      @ravindueshan2786 9 місяців тому

      @@MARENO-vy4cx yes ,remove useUnifiedTopolgy

    • @ravindueshan2786
      @ravindueshan2786 9 місяців тому

      @@MARENO-vy4cx remove the useUnifiedTopology

    • @yuvrajverma4318
      @yuvrajverma4318 8 місяців тому

      just remove the those lines. mine worked perfectly without those.

  • @jayadityag7670
    @jayadityag7670 9 місяців тому

    Awesome

  • @MikiStec
    @MikiStec 11 місяців тому

    Your login is not working man. You only save "token=undefined", you do not send token to frontend and on frontend you do not check it at all.. I can also set manually in Dev Tools. I've already posted such comment but I do not see it here, did you just delete it? If I am wrong, please correct me, do not just delete my comment.. That's not the way to gain trust hm? I was not any rude, I even gave you a shout out how simple and useful your tutorial is, only it's not completed.

    • @AlanCodes
      @AlanCodes  10 місяців тому

      @MikiStec Hey! Thank you for pointing it out. I will make sure to correct those errors in the future. I really appreciate you pointing it out! As far as your other comment goes, I haven't deleted any comments. Even if I make any mistakes, deleting comments won't help anyone who is trying to learn, especially if you are pointing out information that is super valuable and that will help others, and myself included. Thank you once again!

    • @MikiStec
      @MikiStec 10 місяців тому

      @@AlanCodes great. Your way of explaining and your simplified style is just brilliant, keep posting!

  • @abdulmuhsinbaksh8757
    @abdulmuhsinbaksh8757 7 місяців тому

    Hello, Apologies is this is a dumb question, but how does your JWT Token work here? like what does this line of code do: const token = jwt.sign({ userId: user._id }, SECRET_KEY, { expiresIn: '1hr' }), I dont see it being used in the frontend, so how is the token being used to protect?

    • @AlanCodes
      @AlanCodes  7 місяців тому

      Hi @abdulmuhsinbaksh8757 ! Its not a dumb question at all! In that line of code, we are using jwt to generate a token when a user successfully signs in with their username and password. The token is then attached or tied to the user's {user.id} or unique identifier, which was made for them at sign up. Then, in the backend server, the secret key helps validate the generated token to make sure the token is authentic. The token then is passed to your frontend, that way it can be stored in the browser for the signed in session. Lastly, we are setting the token to expire 'in 1hr', securing the session for automatically logging users out after 1 hour.
      Hope this helped!

    • @abdulmuhsinbaksh8757
      @abdulmuhsinbaksh8757 7 місяців тому

      @AlanCodes how is the token beings stored into the frontend?