MERN Auth - Signup & Login with Email (JWT) | React , Node, Express, MongoDB

Поделиться
HTML-код
  • Опубликовано: 3 окт 2024

Комментарии • 198

  • @CyberW0lves
    @CyberW0lves  2 года назад +9

    Watch this video : ruclips.net/video/KqcEVUI7-s0/видео.html In this video I implemented authentication with refresh and access token, role based authorization and protected routes only authenticated user can access that route.

    • @theabhisengar
      @theabhisengar Год назад

      After this whole application, how can run my application? ( can you tell me please).

    • @Di1eepNagendra
      @Di1eepNagendra Год назад

      @@theabhisengar how to run

    • @theabhisengar
      @theabhisengar Год назад

      @@Di1eepNagendra yuppp

    • @Di1eepNagendra
      @Di1eepNagendra Год назад

      @@theabhisengar tell me bro

    • @RabiaInam
      @RabiaInam 10 месяцев назад

      how to run bro???tell plz you make all ur application but dont show how to run this app????

  • @86thecake
    @86thecake 2 года назад +5

    I've been struggling big time to get my JWT token from my custom backend and login/register users. Wow, this is the best tutorial for front end auth. Thanks so much!

  • @oanshee2462
    @oanshee2462 Месяц назад

    Thanks a lot. The method is really simple comparing to other videos. I used this video, my own code and chatGPT and everyting finally works, good!

  • @tannerbyers6729
    @tannerbyers6729 2 года назад +8

    Love to see another video where you take this and build out a landing page and maybe an app inside the dashboard. Would be v helpful. Awesome code and great tutorial!

  • @rajatsharma6137
    @rajatsharma6137 2 года назад +30

    Great video....but why are you not showing dry run ? You are writing a lot of code and its difficult to keep track of what is the effect of different snippets..

  • @ddhruvarora
    @ddhruvarora Год назад +3

    Live saver bro, thanks a lot. I was stuck on JWT for the past 4 hours, and just because of your video I was able to get it working.

  • @Isticsek
    @Isticsek 2 года назад +15

    Great and helpful content! Thank you very much! I would recommend to you, to talk a bit more louder if possible or remove the background music. Although, subscribed for future content!

  • @mainakmukhrjee6328
    @mainakmukhrjee6328 11 месяцев назад

    Amazing video! And thanks for the source code, it sure helped save a lot of time

  • @mercurygingo8899
    @mercurygingo8899 2 года назад +11

    For anyone getting internal error while logging in change the generateAuthToken() to jwt
    in auth.js file
    before
    const token = user.generateAuthToken();
    after
    const token = user.jwt;

  • @siddharthpasalapudi6168
    @siddharthpasalapudi6168 Год назад

    Very clean ! Thank you so much helped a lot !!

  • @firefistace1909
    @firefistace1909 7 месяцев назад +6

    bruh you didn't even show if its working or not

  • @osamahashmi4807
    @osamahashmi4807 2 года назад

    Appreciated bro this tutorials help me alot tysm again.. keep it up :)

  • @jawaderfani8743
    @jawaderfani8743 2 года назад +5

    bro it is n't good to store user inside the localStorage if I add an empty object inside localStorage I can login 🙄🙄

  • @alzhrthy
    @alzhrthy 2 года назад +1

    Please continue Uploading more videos. Very helpful 💯

  • @sashaohota2437
    @sashaohota2437 10 месяцев назад

    Thank you for the wonderful lesson! :)

  • @suneetnripendra7839
    @suneetnripendra7839 Месяц назад

    thanks so much. this helped me a lot

  • @njorogekamau3820
    @njorogekamau3820 2 года назад

    I'm still building along and I'm really enjoying this

  • @Grimmybol
    @Grimmybol Год назад

    Sakit simo ya boss. Maro maro simo mag computer! Thank you gid ah

  • @arunvvijayan4176
    @arunvvijayan4176 2 месяца назад

    Best Work bro.. thanks to reach me

  • @marcoszorzi1853
    @marcoszorzi1853 8 месяцев назад

    The handleChange function for both SignUp and Login can fail more gracefully if this is applied:
    const handleChange = (e) =>{
    try {
    setData({...data, [e.target.name]: e.target.value});
    } catch (error) {
    console.log(error);
    }

    };
    Thanks for the video, I used it as a refreshment but if this was my first JWT project I think it lacked a bit of detail on what each portion of the code is doing.

  • @madvier_8336
    @madvier_8336 2 года назад

    Nice tutorial, also nice music xD

  • @BapiMallick1000
    @BapiMallick1000 2 года назад

    You are good as delivering Good materials

  • @indikasandun8997
    @indikasandun8997 2 года назад

    Thank you for sharing this video. This is very helpful.

  • @prathammathur7942
    @prathammathur7942 Год назад

    Great , Love the Video very very helpful.

  • @amitshukla2268
    @amitshukla2268 2 года назад +2

    Keep it up bro , channel subscribed . If possible change your theme and you shouldn't play background music 🙂

  • @mehtabrandhawa4814
    @mehtabrandhawa4814 2 года назад +4

    Hey Cyber Wolve! can you also create a more advanced authentication video that also includes roles/permissions like: admin, customer?

  • @WillSmith-qt7me
    @WillSmith-qt7me 2 года назад

    Thanks, useful MERN video.

  • @vishakhamore3778
    @vishakhamore3778 2 года назад +5

    Great video but lacks explaination. Where did the password validation came from? from bcrypt? and I m getting error in route ("Internal server error"). Can you help me to solve?

    • @CyberW0lves
      @CyberW0lves  2 года назад +1

      validations comes from joi package which we created that function in user model. console log error and tell me what is that.

    • @vishakhamore3778
      @vishakhamore3778 2 года назад

      @@CyberW0lves
      In signup route:
      Error: Request failed with status code 500
      at createError (createError.js:16:1)
      at settle (settle.js:17:1)
      at XMLHttpRequest.onloadend (xhr.js:66:1)
      In signin route:
      Error: Request failed with status code 401
      (Invalid email and password) even after having account details in Database.

    • @TheLiiitorres
      @TheLiiitorres 2 года назад

      Is this resolved? Im also having the same problem.

    • @vishakhamore3778
      @vishakhamore3778 2 года назад +1

      @@TheLiiitorres not yet

    • @joaquimmorenopacheco610
      @joaquimmorenopacheco610 2 года назад

      i have the same error when im trying to loggin

  • @neel75
    @neel75 2 года назад

    Very help full video. great content. I have one suggetion add slow calm music. This tune is very disturbing. pls take it in constructive way.

  • @003你好
    @003你好 Год назад

    u followed mvc pattern that is a systematic and simple way to iimplement , subscribed d at the first video bud

  • @richardzotor8807
    @richardzotor8807 2 года назад +2

    @Cyberwolves, My Sign UP and Login buttons are not responding. what can I do to resolve it?

  • @doricade6768
    @doricade6768 2 года назад +1

    It is super helpful. Could you show how to start mangodb and real use it in sign up and sign in

  • @albertoslavica57
    @albertoslavica57 2 года назад +1

    Helo I registered 1 user and it worked but when i try to register the second one it gives me error 500. Login for first user work fine

  • @codingwallah3695
    @codingwallah3695 2 года назад +4

    i implemented this authentication for my college project and I got very good remarks because of you. But now I'm getting "Internal Server Error" while login . How can I solve it? Please help me 🙏

  • @shrutimohanty4031
    @shrutimohanty4031 2 года назад +5

    login and signup button are not working in my case... any possible reason behind this/any possible solution you can give...?

  • @mrkhiladi1147
    @mrkhiladi1147 2 года назад +1

    very helpful video sir please make more project using mern stack

  • @vindiesel2231
    @vindiesel2231 2 года назад

    Compliments for wonderful video. Have a problem, when try to register or login have problem with first name. In sign up, tell me "firstName" is not allowed while if try to login tell me "First Name" is required. Please can help me. Thanks

  • @ioanasoare2642
    @ioanasoare2642 2 года назад +1

    Hi! How can I get the current logged in user's details?

  • @secondarypemail7181
    @secondarypemail7181 2 года назад +1

    It is giving internal server error while signing up

  • @artriusgg9272
    @artriusgg9272 Год назад +1

    why you don't run preview

  • @durotemy8410
    @durotemy8410 2 года назад

    hello cyberWolve your video is so so rich thank you for it....Do u pls have a video where u talked about Redux state management

    • @durotemy8410
      @durotemy8410 2 года назад

      Pls ur reply you have any video for redux .u are the best @cyber wolves

  • @shreyasrao8016
    @shreyasrao8016 5 месяцев назад

    How to create url for database?? U blurred it

  • @ANILKUMAR-mn7pk
    @ANILKUMAR-mn7pk 7 месяцев назад

    bhai ek baat bta simple direct database connect ni krr sakta....connectionparams not defined aadhe ghante se solve ni ho ra....

  • @alikuria2482
    @alikuria2482 2 года назад

    short but detailed

  • @newborn7850
    @newborn7850 2 года назад

    Q1 How to deploy on free cloud / host for testing. Q2. How can admin upload files so that users can access them . Rest your teaching is valuable Thanku

    • @CyberW0lves
      @CyberW0lves  2 года назад +1

      Thank You : )
      a1 You can deploy backend on heroku and frontend on netlify for free. there are multiple resources deploy free for testing.
      watch this video to deploy MERN Stack => ruclips.net/video/I2YkUz-S41o/видео.html
      a2 I have already did that in spotify clone backend video. where you admin can upload songs and users will listen.
      checkout => ruclips.net/video/xvqXCACX9k8/видео.html

  • @Srinivas-G11FSD
    @Srinivas-G11FSD 4 месяца назад

    Hii bro where API in this video
    my frontend and backend was working but I am not getting API how can i do that

  • @tusharnain6652
    @tusharnain6652 2 года назад

    Shouldnt we need to store the the user's token in the database?

  • @rafaelarias9759
    @rafaelarias9759 2 года назад

    What's the best practices for storing JWT, is it localstorage, cookies etc?? Thanks

    • @CyberW0lves
      @CyberW0lves  2 года назад +1

      It's not a best practice to store JWT in local storage. You should store JWT inside an httpOnly cookie.

  • @TopGyearsago
    @TopGyearsago 2 года назад +1

    That user email already exists error could be something like try using another email because it's not safe to do that because someone would know that email exists in the database and if he is trying to hack or something that would be a serious damage to the website

  • @maylens
    @maylens Год назад

    Thank you

  • @majjisobhamadhuri9140
    @majjisobhamadhuri9140 11 месяцев назад

    When i signup it was not navigating to main route...can u pls help me out of this sir

  • @oleksandrdw9454
    @oleksandrdw9454 2 года назад

    How can we get an user information from the token?? I want to add dashboard page and for that I need to get access to the user info..

  • @andresoberhelman9251
    @andresoberhelman9251 2 года назад

    Hey i was having a cors issue when finishing the project. What could be a possible problem?

  • @miltonpena1662
    @miltonpena1662 2 года назад

    Hi i was trynig to follow up on the validations but i could not find them ? how did you code those errors ?

  • @niro100
    @niro100 Год назад

    Hello, I increased select in sign-up in this code and got a problem. Can you help me?

  • @silvialaurovici8573
    @silvialaurovici8573 2 года назад

    i also get an error, the react app is working but nothing is happening after. if you could please help me

  • @FaheemTech
    @FaheemTech 2 года назад

    Which theme are you using?

  • @zavedshaik2760
    @zavedshaik2760 2 месяца назад

    but where is mongoDb

  • @codingVibee
    @codingVibee Год назад

    can you make one simple static user after login ticket booking ?

  • @anbumanic9179
    @anbumanic9179 11 месяцев назад

    After finishing the code you need to run I am understand code but how to run

  • @farhadhossen4548
    @farhadhossen4548 Год назад

    TypeError [ERR_INVALID_ARG_TYPE]: The "id" argument must be of type string. Received undefined
    at new NodeError (node:internal/errors:400:5)
    at validateString (node:internal/validators:163:11)
    at Module.require (node:internal/modules/cjs/loader:1098:3)
    at String.require (node:internal/modules/cjs/helpers:103:18)
    at Object. (C:\Users\farha\authInMern\server\index.js:5:28)
    at Module._compile (node:internal/modules/cjs/loader:1218:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1272:10)
    at Module.load (node:internal/modules/cjs/loader:1081:32)
    at Module._load (node:internal/modules/cjs/loader:922:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
    code: 'ERR_INVALID_ARG_TYPE'
    }
    Node.js v18.13.0
    [nodemon] app crashed - waiting for file changes before starting...
    Code:
    const mongoose = require("mongoose");
    module.exports = () => {
    const connectionParams = {
    useNewUrlParser: true,
    useUnifiedTopology: true,
    };
    try {
    mongoose.connect(process.env.DB, connectionParams);
    console.log("Connected to database successfully");
    } catch (error) {
    console.log(error);
    console.log("Could not connect database!");
    }
    };
    Plz help me ot solve this provlem
    @CyberWolves

  • @181_dhrutandel6
    @181_dhrutandel6 5 месяцев назад

    bcrypt is not installing?someone help

  • @manogaransa2814
    @manogaransa2814 Год назад

    I am getting a below error "Unable to get local issuer certificate". Please help on this
    heroku login
    Warning: Ignoring extra certs from `C:\path\to`, load failed: error:02001005:system library:fopen:Input/output
    error
    » Warning: heroku update available from 7.53.0 to 7.63.4.
    heroku: Press any key to open up the browser to login or q to exit:
    Error: unable to get local issuer certificate

  • @ummehanizubair3892
    @ummehanizubair3892 10 месяцев назад

    I did not get the verification email...what to do?

  • @emmanuelkombeto6700
    @emmanuelkombeto6700 2 года назад

    Hey guy please what the first thing can I run client ou server and it possible to run both together

  • @durotemy8410
    @durotemy8410 2 года назад

    hello quick response sir?? when did u create the token ..is is during signup or login??

  • @RajaHammadAhsan
    @RajaHammadAhsan Год назад

    i found this error (connection()
    ^
    TypeError: connection is not a function) can some body help me?

  • @SergioSanchez-rh4po
    @SergioSanchez-rh4po Год назад

    For those having a 500 error at the log in moment, in my case I declared the Validation function in auth.js inside the POST route, when moved outside Log in work normally.

    • @madhurshinde4988
      @madhurshinde4988 Год назад

      can you tell me exactly what you did, its confusing to understand

    • @SergioSanchez-rh4po
      @SergioSanchez-rh4po Год назад

      @@madhurshinde4988 by mistake, I wrote the validation function inside of the Post function route.
      It has to be declared outside of it.

  • @abdullahashraf4420
    @abdullahashraf4420 Год назад

    My code is giving internal server error on signin. Can someone please guide me as to why I'm getting it?

  • @piyushtiwari6471
    @piyushtiwari6471 Год назад

    non monospace font for coding ? Interesting

  • @femi9912
    @femi9912 2 года назад

    This is great but the req.body is empty.

  • @SurajX1100
    @SurajX1100 10 месяцев назад

    hey i am getting internal server error while login please help

  • @rigobertohernandez5680
    @rigobertohernandez5680 2 года назад

    Bro, how to implement, edit and deleite user?

  • @codewarsfx161
    @codewarsfx161 2 года назад

    good stuff

  • @ganeshaM-q3x
    @ganeshaM-q3x 3 месяца назад

    When I trying to login i am getting internal server error at port 500!!. please help me with this!!

  • @thisisarpankumar
    @thisisarpankumar 6 месяцев назад

    How to run the server and client?

  • @diekesydney3162
    @diekesydney3162 Год назад

    Cool video

  • @daffaofficial4125
    @daffaofficial4125 Год назад

    hello how is trials to google chrome ?

  • @shwetakakde4522
    @shwetakakde4522 Год назад

    how to solve this error :- Module not found: Error: Can't resolve './components/Singup'
    in 'D:\Projects\fullstack_authInMern\client\src'

    • @irshadsheikh9858
      @irshadsheikh9858 Год назад

      Given folder name is wrong correct might be ./components/Signup or given after ever folder name you have given

  • @k.a.rayhan7017
    @k.a.rayhan7017 2 года назад

    hey. after 4:43 I get this error..
    UnhandledPromiseRejectionWarning: MongoParseError: option usedunifiedtopology is not supported
    what should I do !!

    • @CyberW0lves
      @CyberW0lves  2 года назад +1

      Remove useUnifiedTopology from connection params object. We don't required for new update :)

  • @shirsakshrestha4798
    @shirsakshrestha4798 2 года назад

    Sir when you will add the remaining video tutorial of spotify

  • @FreeSkypeGenerator1
    @FreeSkypeGenerator1 2 года назад

    after many tutorial I found yours
    thanks a lot

  • @syedsaadali420
    @syedsaadali420 Год назад

    beast

  • @kulvanth1491
    @kulvanth1491 2 года назад

    Don't we need any middlewares in the backend ?

    • @CyberW0lves
      @CyberW0lves  2 года назад

      If you want any specific route accessed only by authenticated user there you can add middleware. Actually I'have implemented this in spotify backend video go checkout ruclips.net/video/xvqXCACX9k8/видео.html

  • @prasannarajen8812
    @prasannarajen8812 2 года назад +2

    i get this error : localhost:8080/api.users 404 (Not Found)
    Please help me out sir

  • @mavguimaraes
    @mavguimaraes Год назад

    After successfully signup, if I try sign in I've got Internal Server Error. If I click in the error shown in the console I've got in the browser 'Cannot GET /api/auth'. Some light on how to solve this?

    • @irshadsheikh9858
      @irshadsheikh9858 Год назад

      getting internal error while logging in change the generateAuthToken() to jwt
      in auth.js file
      before
      const token = user.generateAuthToken();
      after
      const token = user.jwt;

  • @AcuitSrishaGr
    @AcuitSrishaGr 2 года назад

    Bro...i have used react js....and I'm getting error like use navigate and navigate is not found in react-router-dom.....could you tel me how to solve?

  • @abdulabdel9187
    @abdulabdel9187 2 года назад

    HI! Thank you very much for this video it was a great help! 🙏 But how can I access the user information after loging inn? I want to display the user name and other things like picture inisde the profile when you are logged inn

    • @CyberW0lves
      @CyberW0lves  2 года назад +1

      Add a middleware to verify json web token. After verifying you will get user ID from that you need get user details. I have implemented this in Spotify backend video.

    • @abdulabdel9187
      @abdulabdel9187 2 года назад

      @@CyberW0lves Yes I found it. Thank you very much. One thing I dont understand is why you added the labels to the Joi.string part. Is it necessary? If so what is it for?

    • @abdulabdel9187
      @abdulabdel9187 2 года назад

      Never mind, i found it out :D

  • @hatemhenchir
    @hatemhenchir 2 года назад

    { error && {error}} explain it pls

  • @farhanosmanhaider8251
    @farhanosmanhaider8251 2 года назад

    thanks a lot.. @CyberWolve.... But the link which is sent with the email, is a link with localhost and related port. So, how that link could be worked on others device ? How can we generate a link which will work in every device ? PLZ REPLY KINDLY

    • @CyberW0lves
      @CyberW0lves  2 года назад +1

      In order to verify link in every device, you need to deploy your backend (heroku) and fronted (netlify). Then add frontend url in backend configurations so we can send an email with that url. Now you can verify it from everywhere because it's on internet.

  • @k.a.rayhan7017
    @k.a.rayhan7017 2 года назад

    How to use protected routes using node JS authentication ?? Please help !!

    • @CyberW0lves
      @CyberW0lves  2 года назад

      By using middlewares. My next video is about authentication via refresh and access token and role based autherization. In that video i will show you how to make protected routes. : )

  • @AruneshkumarG
    @AruneshkumarG Год назад

    bro how to find the jwtprivatekey

  • @vignesh.soundiram4922
    @vignesh.soundiram4922 2 года назад

    I need help bro!! i dont want the registration part instead i want only few users to be able to login.. How do i achieve this? Plss help..

    • @CyberW0lves
      @CyberW0lves  2 года назад +1

      My next video is about Authentication with refresh token and role based authorization. Will upload after a week.

  • @hgsbrodi
    @hgsbrodi 2 года назад

    What about verifying the token on the backend?

    • @CyberW0lves
      @CyberW0lves  2 года назад +1

      We have to add middleware for authenticating user in backend. I have implemented that in Spotify Backend video checkout :)

  • @TaprobanaOrg
    @TaprobanaOrg 2 года назад

    ❤❤❤❤

  • @rajwindersingh8361
    @rajwindersingh8361 2 года назад

    how to start the
    program

  • @Islamicshorts500
    @Islamicshorts500 9 месяцев назад +1

    Bro Kuch bhi smjh nhi aarha smjhaao to sahi se

  • @newborn7850
    @newborn7850 2 года назад

    how to deploy it on heroku

  • @anonymous-qt4ep
    @anonymous-qt4ep 2 года назад

    VS code theme ?

  • @hasinpramodya9652
    @hasinpramodya9652 2 года назад

    I implement this project and successfully create users but I got Internal Server Error(500) when I am logging. how to solve this error?

    • @CyberW0lves
      @CyberW0lves  2 года назад

      Console log the error from login route. Let me know what error you are getting in command prompt.

    • @SurajX1100
      @SurajX1100 10 месяцев назад

      hey i am also getting the same please tell me how to solve it