React User Login and Authentication with Axios

  Рет қаралды 577,366

Dave Gray

Dave Gray

Күн бұрын

Пікірлер
@DaveGrayTeachesCode
@DaveGrayTeachesCode 3 жыл бұрын
Creating a login with authentication is often a required part of creating a web app. In this tutorial, you will learn how to create a login form that submits information with Axios for authentication with a server. The login will also be created with accessibility in mind. This is really part 2 of a registration / login tutorial series. Part 1 is the registration with validation tutorial found here: kzbin.info/www/bejne/mKPGeX5phZt2nrM
@SmartWizzard
@SmartWizzard 3 жыл бұрын
Hi @dave, I missed the other video which I will watch later but I have future request for this video. Can you add a session & localStorage to maintain the use session for certain period so that when you refresh local host it won't log you out until and unless you logout or session expires. These are a good add-ons to this project. Cheers! and thanks for your work.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 3 жыл бұрын
Hey SW, thanks for the request! I do not recommend localStorage (or sessionStorage) for storing tokens even though the majority of tutorials use them. A refresh token should really be in an http-Only secure cookie with the access token stored in app state. I cover this in detail for the backend in my Node JS full course: kzbin.info/www/bejne/nGOoonh5nrl1gpo But you are absolutely right about adding a persistent login to this series, and I plan to do that (with the cookie)! 💯🚀
@pranjalruhela1103
@pranjalruhela1103 7 ай бұрын
Hi @DaveGrayTeachesCode I wanted to know which sections in the node video (its 7 hours long) correspond to this project? can you give us the chapters exactly
@nirajchandrajoshi
@nirajchandrajoshi 6 ай бұрын
You have done a great job; I am watching this in 2024 and I will not hesitate to say that I didn't find such tutorial on entire you tube. So super helpful to me.
@r0ck3th76
@r0ck3th76 2 жыл бұрын
Finally someone that speaks clear and concise. Loved the tutorial going to look at your full course. Thanks alot.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're welcome! 🙏
@darkNovaskar
@darkNovaskar Жыл бұрын
I know what you're talking about. Those thick azz peanut butter on the roof of their mouth type accents. They're very annoying when looking for solutions in coding when coding is already hard enough 😤.......
@shawn.builds
@shawn.builds 2 жыл бұрын
Dave, your channel is massively underrated. Really well put together + love how each video in the series builds on the previous. This is exactly what I look for in Udemy courses that I pay for! Liked and subbed!!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Much appreciated! Thank you, Shawn! 💯
@tarrasuribabu9571
@tarrasuribabu9571 Жыл бұрын
Thank so much. In India we call teacher as GURU. Your my guru from now on.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Thank you!
@DH-jw4th
@DH-jw4th 3 жыл бұрын
Thank you for responding with this video after my comment on the react tutorial. Your course stacks backend and front end expertly! Now, the server will have issued a refresh token in the form of a HTTP cookie. I cant wait to see how you handle the refresh in the client app!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 3 жыл бұрын
Thank you, DH! I'm also looking forward to setting up role-based protected routes!
@tabliqatchi6696
@tabliqatchi6696 2 жыл бұрын
How amazing, this is the first tutorial I've watched from you and it's so very well organized and you explain things bit by bit. Thanks a lot Dave.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're welcome! I am glad it helped 💯
@DanielGarcia-vc7ci
@DanielGarcia-vc7ci Жыл бұрын
just landed here today and I want to say that this channel is amazing!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Thank you!
@rishavmasih9450
@rishavmasih9450 11 ай бұрын
Damn, one of the best youtube channels in the developer space.
@ivana1755
@ivana1755 Жыл бұрын
Couldn’t be more clear! I’ve already have worked doing some things in React but this wrap up my knowledge rather nicely! Congrats 🎉 I just subscribed!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Welcome aboard!
@companyjoe
@companyjoe 2 жыл бұрын
The clarity, the excellent presentation. Best in KZbin. I'll be referring to you as Boss.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thank you for the kind words, Jukka! 🙏🙏
@santiagopetrungaro
@santiagopetrungaro 2 жыл бұрын
This series of videos is exactly what I was looking for. Let me thank you for this great content! Perfectly explained and such a clean code that makes it even easier for someone to understand what is being explained. Thanks again
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're welcome, Santiago! 🙏
@Serhii_lolovich
@Serhii_lolovich 2 жыл бұрын
amazing man
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Glad it helped! 💯
@saadarman4718
@saadarman4718 Жыл бұрын
Great work, you have put so much effort in these tutorials. Learned a lot. Thanks.
@Trauma_Clown
@Trauma_Clown 2 жыл бұрын
OMG, you're so good at making things complicated for beginners !
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Your sarcasm is not lost on me. 😆
@irinamihai-s9n
@irinamihai-s9n Жыл бұрын
I am still a beginner web developement but I really apreciate your work. Thank you
@abdallahabdoulhakim2998
@abdallahabdoulhakim2998 14 күн бұрын
Great content as always! Just a slight remark, you actually do no need to use JSON.stringify in the post request as Axios automatically converts the data to JSON.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 13 күн бұрын
Good note - this video is around 2 1/2 years old. I'm guessing the version I used in the video didn't do this.
@vincent3542
@vincent3542 2 жыл бұрын
dave is the only youtuber, who before i even watched the video, i gave a thumbs up. quality of content, delivery of concepts all neatly wrapped and can be understood in depth 😍😘
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thank you for the kind words, Vincent! 🙏🙏
@trinhphong7844
@trinhphong7844 8 ай бұрын
For anyone comes to this tutorial lately, the second argument of axios request, in the time this tutorial was published, it needed to be json (that is why he used json.stringnify). But currently, it is ok to pass an object, no need to convert to json anymore Moreover, in a axios post request, the content type is default set to json, so u can remove that
@kirillzlobin7135
@kirillzlobin7135 Жыл бұрын
28:15 Nice trick. Did not know about that :)
@danielguise
@danielguise 11 ай бұрын
Brilliant! This is amazing content. You have an incredible ability to get the complexity across, thank you so much.
@satellitesage2487
@satellitesage2487 2 жыл бұрын
19:33 What else do you typically put inside of the api folder? Aside from the function that creates the axios instance. I already placed my api calls in their respective stores so.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Good question - it really depends on how you (or your team) wants to organize the project. I like the modern Redux approach where you have a separate API layer with RTK Query and all endpoints are defined there.
@aaaliii4u
@aaaliii4u 2 жыл бұрын
you're the coder Dave.. thanks for such awesome stuff!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
My pleasure!
@Notyoubiz
@Notyoubiz 2 жыл бұрын
I like how specific this is. Thank you for making content for us beginners and intermidiate users.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're very welcome! 💯
@azaiezsene3165
@azaiezsene3165 Жыл бұрын
Thank you very much for this. It helped alot . I really think this tutorial is underrated.
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Glad it was helpful!
@learner8084
@learner8084 Жыл бұрын
This guy is great. I like the tutorial a lot and learnt a lot too !
@ryant2350
@ryant2350 2 жыл бұрын
Amazing tutorials Dave, truly.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Glad to hear that! 💯
@sabrinalucianavieirapinto5602
@sabrinalucianavieirapinto5602 3 жыл бұрын
Amazing tutorial, I learn much things that I was struck in, thank you!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 3 жыл бұрын
You're welcome! 💯
@Dame-Techie
@Dame-Techie 2 жыл бұрын
Very Easy to follow tutorial. Loved every bit of it. Will definitely watch the entire playlist and more of your courses.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Happy to hear that!
@changNoi1337
@changNoi1337 2 жыл бұрын
Why using at 24:13 (in a try / catch block) optional chaining? response.data will be guaranteed to exist from axios. Even when there is no AccessToken on the response.data we will get undefined either way, right? And in case we get an error, we will jump straight to the catch (error) block, right? I'm new to this optional chaining thing, thats why I'm asking. Cheers Tim
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Hi Tim - I often use optional chaining as it doesn't hurt anything but in the instance you described, it is probably not necessary. Good work! 💯
@changNoi1337
@changNoi1337 2 жыл бұрын
@@DaveGrayTeachesCode Thanks for answering that. I think I understood it now.
@emAyush56
@emAyush56 Жыл бұрын
Hey Dave, your tutorials have been really helpful to me. I have this question @ 22:37 - What is the thing with withCredentials? Why do we need to specify it? I was working with an API and I was getting an error when I set withCredentials to true. I have googled about it a bit but it wasn't clear to me why it is needed? Could help me understand its need?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Glad to hear that. It is a config setting in axios. If I remember correctly, I used axios here. Reference this page: axios-http.com/docs/req_config
@MrBuloy11
@MrBuloy11 Жыл бұрын
"keep striving for progress over perfection and a little progress everyday will go a very long way" I love it :)
@DevBigEazi
@DevBigEazi 2 жыл бұрын
This is the most straight forward tutorial i have ever come accrossed. Thanks to you Dave
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're welcome!
@hamidabdolrahimi4606
@hamidabdolrahimi4606 2 жыл бұрын
Thank you man. Awesome, best tutorial ever. Keep it up
@kaushikchopra3149
@kaushikchopra3149 Жыл бұрын
After so many days of searching on KZbin, I stumbled upon your video playlist on how to set refreshTokens and use them in a React app. I also learned a lot about Private Routes and other concepts. I'm extremely grateful for the valuable content you've provided. I really appreciate what you're doing. Although the playlist is a year old, it's still the best. Just one small doubt i have. In the context API, you have initialized the auth state and createContext with an empty object. If i do the same, it is not redirecting to the login page. May I know why?
@kirillzlobin7135
@kirillzlobin7135 Жыл бұрын
25:00 But why should we save the password in AuthContext. Is it considered to be safe?
@Adrian-nc1tp
@Adrian-nc1tp Жыл бұрын
I am currently trying to make a sign in and sign up with vite react js and also using Axios as the database. What is the difference between the normal react js and the vite react js? Is there a way for me to convert between react js to vite react js?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
It is still just React.js. Vite is more for the dev environment and build. Just check the Vite.js site for the changes on things like environment variables, static assets, etc: vitejs.dev/guide/
@iliasswork6623
@iliasswork6623 2 жыл бұрын
Dave, I can't thank you enough for this amazing content. Thank You!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're very welcome!
@gandamraviteja7019
@gandamraviteja7019 Жыл бұрын
Well explained hats off to u Dave U r helping me a lot thanks is a very tiny word for ur work amazing buddy
@danieltkach2330
@danieltkach2330 2 жыл бұрын
Is it correct to set the axios base url depending on whether we are in a dev or prod environment? I've been doing the env checking using interceptors, and I discovered here the base url setting, which one is better in this case? Thanks for sharing your knowledge Dave.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
The env with a production vs development check is great. The environment variable still provides a constant for the BASE_URL which is the main idea.
@khaidoan5858
@khaidoan5858 11 ай бұрын
at 24:58, is it necessary and safe to setAuth with pwd ? Thank you
@adamwarzecha4439
@adamwarzecha4439 2 жыл бұрын
What will happend if user refreshes page after logging in? Won't context data be lost ?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Link to Login Persistence video in the description, but I suggest watching the full series in order.
@pranjalruhela1103
@pranjalruhela1103 7 ай бұрын
Hi Dave! Which parts of the Node JS video corresponds to the login project?
@shivanshmishra7992
@shivanshmishra7992 Жыл бұрын
Why are you not popular yet?!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Hmm, I guess everyone has their own definition of popular. I was happy reaching 100k subs! 🚀 Still growing!
@shivanshmishra7992
@shivanshmishra7992 Жыл бұрын
@@DaveGrayTeachesCode Do you have an udemy course or something equivalent? I would buy it.
@jamesxiao4996
@jamesxiao4996 2 жыл бұрын
Hi Dave, First of all thanks for these great tutorials!! What's the difference between this tutorial and your "React Login Authentication with JWT Access, Refresh Tokens, Cookies and Axios" tutorial. Also, is the backend that you use in this tutorial created in the full Node js Guide? Thanks!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're welcome! This is part of a video series. This video is the 2nd video. The other one you mention is the 3rd video. Playlist: kzbin.info/aero/PL0Zuz27SZ-6PRCpm9clX0WiBEMB70FWwd ...yes, the backend is created in my Node.js full course here: kzbin.info/www/bejne/nGOoonh5nrl1gpo
@Alone.journey_0
@Alone.journey_0 Жыл бұрын
Thanks Dave Gray I really appreciate your commitment and time to go through thing like these, and how you take your time to explain bit by bit of the code thanks👍👊
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
You're very welcome!
@ismailhrana3915
@ismailhrana3915 2 жыл бұрын
Thanks for describing every steps in details and thanks again for maintaining code quality. #subscribed
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're welcome! 🙏🙏
@thehitlist4046
@thehitlist4046 3 ай бұрын
Great video! Quick question. If my role is actually a string and not an array like it is in your video, would the include that you used for the protected routes still work?
@atharvameher5880
@atharvameher5880 11 ай бұрын
Thanks for source code man appreciate it. You gained new sub
@preethpalsinghthakur7748
@preethpalsinghthakur7748 2 жыл бұрын
Excellent tutorial.Thanks alot Dave.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're welcome!
@enes98li1
@enes98li1 2 жыл бұрын
What makes your videos great is that you split frontend and backend. You didn't use any backend here yet I still understand what is going on on backend and how to manage login registration in frontend with auth.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thank you for the kind words, Enes! 🙏
@brucelee7782
@brucelee7782 8 ай бұрын
Isnt a generic error message better than a specific one like "no server response"? For mitigating hackers
@kevinmutinda8429
@kevinmutinda8429 2 жыл бұрын
Thanks for the content... any suggestions on how to persist the context values upon resfresh of the page
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Keep going in this series. There is a video dedicated to that. Links in description - look for Persist Login
@kevinmutinda8429
@kevinmutinda8429 2 жыл бұрын
@@DaveGrayTeachesCode Thanks
@fmaciel2
@fmaciel2 2 жыл бұрын
Thank you very much for the great tutorial! That's exactly what I've looking for to understand authentication.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Glad it was helpful!
@josephchinemeremjerry3167
@josephchinemeremjerry3167 2 жыл бұрын
I skimmed through the video, excellent job, however I have a silly question, forgive me, How were you able to route to the home or make shift home page upon logging in?
@josephchinemeremjerry3167
@josephchinemeremjerry3167 2 жыл бұрын
ooh, I just saw it, where you used the success state to render a page
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Glad you found it! 💯
@SniperKillerARG
@SniperKillerARG 2 жыл бұрын
Thanks for sharing your knowledge!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're welcome, Lucas! 💯
@nataliapylko6494
@nataliapylko6494 Жыл бұрын
Great explanation! Thank You for your work!
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Glad it was helpful!
@GabrielMartinez-ez9ue
@GabrielMartinez-ez9ue 3 жыл бұрын
Excellent material as always.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 3 жыл бұрын
Thank you, Gabriel 🙏💯
@Доджи-м6щ
@Доджи-м6щ 3 жыл бұрын
Great job. Thanks Dave.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 3 жыл бұрын
Thank you! 💯
@prasathj7436
@prasathj7436 Жыл бұрын
Excellent tutorial. Thanks a lot.
@farzindev
@farzindev 2 жыл бұрын
As always, you make it so simple for us. thank you. my question is, what happens if I add react-query to my app. should I change this AuthProvider and use react-query somehow? can you make a video about that? Thank you
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thank you, Francis! 🙏 Yes, it would be a good refactor with React Query, and I plan to do this video soon! 💯
@tarekghosn3648
@tarekghosn3648 2 жыл бұрын
hmmm will you be my next binge?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
🍕🍕🍕
@aleksandrpetrov3938
@aleksandrpetrov3938 Жыл бұрын
Hi, Dave. Ty for your lessons. Why do you put post request body in JSON.stringify function? We can just put js object there as the 2nd parameter { user, pwd }
@alexkost70
@alexkost70 Жыл бұрын
Great video, it helped me a lot!
@vishwasmakwana125
@vishwasmakwana125 2 жыл бұрын
Hi Dave , Your tutorial is awesome , I want to follow along react-authentication series but i dont want to create nodejs project for backend from scratch that we are using in current project. Is there any way i can directly setup backend and focus on react part . If there is way please let me know it will be greate help Thanks
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You may find another Rest API, but it may not respond the same. You could possibly learn the React concepts without using the backend, but if you want it to function as you go, you'll need the backend Rest API.
@ImperiousRex13
@ImperiousRex13 2 жыл бұрын
Thanks, Dave really great tutorial. My only issue now is figuring out how to logout
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
If you keep going in this React Login series, a logout is added to the flow.
@rogerfantw
@rogerfantw 2 жыл бұрын
Thanks for your amazing and concise tutorial. Would you make a tutorial for Django Rest Framework, since I wanna use Django as a backend Server instead of Node JS.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thank you for the request!
@loussifchiheb8309
@loussifchiheb8309 2 жыл бұрын
Just perfect and the best one , wich theme vs code you are using ?? because its beautiful
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thank you 🙏 GitHub theme 🚀
@loussifchiheb8309
@loussifchiheb8309 2 жыл бұрын
@@DaveGrayTeachesCode thank you and keep it up , you are the best
@michahaj5659
@michahaj5659 2 жыл бұрын
What prettier you are using to react?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
I don't remember exactly what I may have been using at the time I made this video. I have used the Prettier extension in the past. Right now, I am sticking with ES7 React Snippets and default formatting from VS Code.
@thomass2040
@thomass2040 2 жыл бұрын
Amazing content!!! !! :) Added to my TOP content providers 💪💪 one thing, it would be nice to have this backend api link to test it out on ourself or maybe some json-server to mock it somehow :) Keep doing, amazing work! waiting for same with typescirpt 😊😊
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thank you, Thomas! You can use the Node.js backend that is built in my Node.js for Beginners course here: kzbin.info/www/bejne/nGOoonh5nrl1gpo
@techtipsbydigitron9738
@techtipsbydigitron9738 2 жыл бұрын
You are a good teacher. Everything that you explained realy understandable. Thank you very much..❤️🔥
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Glad it was helpful! And you're welcome! 💯
@danieltkach2330
@danieltkach2330 2 жыл бұрын
Another question, what's the reason you use JSON.stringify to parse the body you send in a post request? I've always sent the object directly. What are the pros and cons?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Good question! 💯 This is something I did not need to do with Axios, but you must do it if you just use the fetch API. There is no con, but if you do not do it, Axios will do the object to JSON conversion automatically. Another reason to like Axios!
@akashagrawal5067
@akashagrawal5067 7 ай бұрын
Hi, pls let me know which nodeJS tutorial need to follow of your youtube channel so that I can also create the same backend environment in my local with authentication fucntionality which you are using in this ReactJS tutorial.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 7 ай бұрын
The Node.js Full Course - there should be a link to it in this video's description.
@MrQVeeBoo
@MrQVeeBoo Жыл бұрын
super and very good explanation with example. very nice. thx
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Thank you!
@mayurdevhare7289
@mayurdevhare7289 2 жыл бұрын
Hello Dave, Your Tutorial is awesome can you please tell us how you connect with database mysql and curd operations
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thank you! Connecting to MySQL or any other database happens in the backend code. If you use Node.js with MySQL, you could use something like Sequelize to connect with the database: www.npmjs.com/package/sequelize
@charliema3762
@charliema3762 2 жыл бұрын
I've watched a few of your videos. You are a really fine instructor, and your pacing is perfect. Thank you!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Thank you for the kind words, Charlie! 🙏
@tinvo5369
@tinvo5369 2 жыл бұрын
this is the best tutorial for me, thanks!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're welcome! 💯
@emmanuelakogwu7761
@emmanuelakogwu7761 2 жыл бұрын
This is golden.....Thanks Dave your a saver. my challenge is that I tried to use your already created backend so i can follow along but I can't seem to get the desired result. no response from the backend. the best i got is an index.html. how do I call the other end points like register, login so I can get the token and all from the front end. i don't know backend yet(still focusing on front end)
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Ah yes, you need to set up your own MongoDB with it and provide the environment variables... All backend stuff completed in my Node.js course.
@emmanuelakogwu7761
@emmanuelakogwu7761 2 жыл бұрын
Okay.... thanks a lot
@avel8965
@avel8965 2 жыл бұрын
Hello Dave! Thank u so much! Can you add mail confirmation guide (after registration) ?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
This is a good suggestion! Thank you, Avel. It may be more of a Node.js tutorial than a frontend tutorial, but it all goes together. 💯🚀
@avel8965
@avel8965 2 жыл бұрын
@@DaveGrayTeachesCode 💪🏽
@njoeror
@njoeror 2 жыл бұрын
Dave, Thanks a lot for this tutorial! Do you have another version of this tutorial with Typescript ? Or do you know how to use { setAuth } with Typescript ?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're welcome! I have created tutorials with Typescript on my channel yet - beginner series coming soon! setAuth is the setState function from useState. Look up how to use Typescript with setState.
@shubhamsood589
@shubhamsood589 2 жыл бұрын
@@DaveGrayTeachesCode, can you please help me with the course link that you referred to in the video along with react with the typescript playlist. I am unable to find it in the description section.
@kostyapolishko6282
@kostyapolishko6282 2 жыл бұрын
Thank you so much. It is a good example, but how to call axiosPrivate not inside the Component, for example inside redux operations?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're welcome! 🙏I've had several requests for a login flow with Redux which will make a good future tutorial! 💯
@vasilispapasakellariou4074
@vasilispapasakellariou4074 2 жыл бұрын
Hello sir. Again an excellent tutorial with amazing explanation. I have some questions if i may ask. 1. Is state safe to store authentication details? And we have to login every time we refresh page because state will disappear. What is a better authentication approach so we dynamically checking on server if user is authenticated ? Ty for this amazing tutorial
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Hello Vasilis - yes, there are more videos in the series. One provides a solution for Login Persistence which handles persisting your login even when the page is refreshed: kzbin.info/www/bejne/aGiuloyhYpqpgNk ..Best Practices / suggestions for storing auth state and more in this video: kzbin.info/www/bejne/aYLEd3irYrCeiJo
@vasilispapasakellariou4074
@vasilispapasakellariou4074 2 жыл бұрын
@@DaveGrayTeachesCode Thx sir. U deserve everything.
@abraham.tesfay
@abraham.tesfay 8 ай бұрын
Great tutorials. Thank you.
@joshua4262
@joshua4262 2 жыл бұрын
The cookie doesnt set on the front end. The token does generate at the backend though but idk whats wrong. I believe is code is flawless.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Does your backend have secure: true but you are in dev mode with localhost only using http instead of https? Just a possibility. Remove secure: true while in dev mode if so.
@lljdm
@lljdm 2 жыл бұрын
should I do in the same project file the backend in your node js tuts sir?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Your backend is a different project.
@kevindeming9765
@kevindeming9765 2 жыл бұрын
Do you have a tutorial on forgotten password reset?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Not yet, but that would be a good addition! 💯
@anushangapavith7162
@anushangapavith7162 2 жыл бұрын
Thank you for the video it was very helpful ❤️ But I have a concern about logout. It seems you haven't implement a logout function here... 🤔
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Keep going in this series. There will be one.
@arpitsinha3835
@arpitsinha3835 Жыл бұрын
what is the use of setAuth and auth variable ,code can be in flow to reach successful sign in without it
@dusanvulic7275
@dusanvulic7275 2 жыл бұрын
@20.00 you mentioned backend created with other tutorial.....I strongly think that would be MUCH FAIR if you said that at the start of this video.
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
This is a frontend tutorial. You can use any backend with this. I offered mine as an example that is available if you want.
@MrVipulLal
@MrVipulLal 2 жыл бұрын
Great stuff, mate. Many thanks
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're welcome!
@vnm_8945
@vnm_8945 2 жыл бұрын
exactly what I need it, thank you very much!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
You're welcome! 💯
@TejaswiniC-us8pn
@TejaswiniC-us8pn Жыл бұрын
Hello dave!.... what can I do to add both username/email option in the single input?
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
I have never seen a form ask for username and email all in one single input? Seems strange. I don't recommend it. You want to have separate validation for each item.
@tejaswinic
@tejaswinic Жыл бұрын
@@DaveGrayTeachesCode many websites asks for either username login or email login. User can opt either username or email login! For example instagram.. we can either login usomg username or phone number. How can we do it?
@TejaswiniC-us8pn
@TejaswiniC-us8pn Жыл бұрын
@@DaveGrayTeachesCode Not username AND email , but username or email!
@germ7169
@germ7169 2 жыл бұрын
After changing the auth state how can I navigate to a protected route? When I change the auth state I think it rerenders and I don't get to navigate
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Keep going in this series of videos. There is a video dedicated to protected routes following this one.
@elgingeroo
@elgingeroo 2 жыл бұрын
What keyboard do you have?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Logitech wireless. It can be loud at times, but it has a great feel.
@elgingeroo
@elgingeroo 2 жыл бұрын
@@DaveGrayTeachesCode what model? I am in love with the sound!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
@@elgingeroo K270 - www.logitech.com/en-gb/products/keyboards/k270-unifying-wireless.html
@youtubespecial6517
@youtubespecial6517 2 жыл бұрын
How you make directly thise 3 pieces of state .. Can you tell me this shortcut key. And you can also make video on shortcut in vs code it will be really helpful
@youtubespecial6517
@youtubespecial6517 2 жыл бұрын
Ohhh are copy pasting it from somewhere?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Can you refer to a timestamp of the video for me to reference? Usually when you see me changing multiple things at the same time, I have pressed Ctrl+D to select more than one at a time.
@odigwenwike7575
@odigwenwike7575 8 ай бұрын
Any reason why you're saving user password in global context?
@shivanshudev4924
@shivanshudev4924 2 жыл бұрын
From where I can learn about the backend used in this?
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
In the description, there is a link to a Node.js for Beginners course. The backend is built there. Or you can build your own backend in whichever language and/or framework you choose.
@elinabrahmandam8652
@elinabrahmandam8652 2 жыл бұрын
Hi, is it possible to write this information into some sort of database instead? This was a great tutorial!!
@DaveGrayTeachesCode
@DaveGrayTeachesCode 2 жыл бұрын
Of course! You can build the backend to integrate with this React Login series by completing my Node.js course where it is built: kzbin.info/www/bejne/nGOoonh5nrl1gpo ..the Node.js course uses a MongoDB database.
@soothingsoundsofnature100
@soothingsoundsofnature100 Жыл бұрын
Very good tutorial. Can you also add the "Forgot Password" feature. Thanks
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
Good request!
@jeetudewangan9836
@jeetudewangan9836 Жыл бұрын
why it is giving cors error i'm already added the frontend address in allowedOrigins. When i use withCredentials: true it gives cors error but when i remove withCredentials:true it works fine what's the issure occured here. And why we are using withCredentials here, can you explain it with easy example ? I pull my hair from 2 days just because I am not able to understand
@DaveGrayTeachesCode
@DaveGrayTeachesCode Жыл бұрын
The withCredentials option likely triggers an OPTIONS preflight request which is part of CORS. Without it, it likely doesn't. This could be something as simple as including a trailing slash / in the URL in your allowedOrigins.
Enceinte et en Bazard: Les Chroniques du Nettoyage ! 🚽✨
00:21
Two More French
Рет қаралды 42 МЛН
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН
Every React Concept Explained in 12 Minutes
11:53
Code Bootcamp
Рет қаралды 884 М.
React Authentication Crash Course With Firebase And Routing
56:00
Web Dev Simplified
Рет қаралды 660 М.
Top 6 React Hook Mistakes Beginners Make
21:18
Web Dev Simplified
Рет қаралды 585 М.
JWT Authentication | Node JS and Express tutorials for Beginners
1:00:03