React Firebase Authentication - Protected Routes - Context - (Firebase v9) 🔥

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 ส.ค. 2024
  • In this video I go over Firebase v9 Authentication in React JS. We will be able to create a new user by email address, sign in, sign out, and check to see if a user is logged in or not. We will use react-router-dom v6 to navigate pages after signing in. We will also use protected routes. This means you will be required to be signed-in as a user to view the specified page otherwise the user is routed to the sign in page. Context will be used so we can access the user details in any of our React components wrapped in our Provider. All the UI styling is done with tailwind css. Check the time stamps below. Feedback welcome - thanks for watching!
    If you enjoyed the video and would like me to demonstrate social sign-in (google/facebook) with firebase or how to store the user data into a firestore database then please let me know in the comments below! 👍
    ZeroTo Mastery:
    - Master React JS Course - bit.ly/Learn-React-JS
    - Complete Web Developer in 2023 - bit.ly/Complete-Web-Developer...
    Coding Challenges!
    bit.ly/Code-Challenges
    Timestamps:
    0:00 - Intro
    00:31 Create react app
    02:01 Install tailwind css
    03:16 Update to react 18
    04:36 Install react-router-dom
    06:07 Create Sign-in/Signup components
    17:52 Install/configure Firebase
    23:45 Use Context
    28:30 Create new user
    38:50 Check to see if user is signed in onAuthStateChange
    44:30 Signout
    47:28 Sign in user
    54:38 Protected routes
    Github repo 💻
    github.com/fireclint/firebase...
    🔥 My Coding Equipment 🔥
    Logitech MX Wireless Keyboard - amzn.to/3xKPFiN
    Logitech MX Master 2S Wireless Mouse - amzn.to/3O5WmRD
    SAMSUNG 49-Inch Gaming Monitor - amzn.to/3mvUy8M
    Shure MV7 USB Podcast Microphone - amzn.to/3O00nqG
    Mic Boom Arm - amzn.to/3NHn6YU
    Monitor Desk Light Bar - amzn.to/3xzKlyj
    🔥 Connect with me on IG 🔥
    / fireclint
    ☕ Support the channel ☕
    www.buymeacoffee.com/clintbriley

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

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

    Legendary video. The other videos I found about Firebase authentication went fast and took everything for granted, but you took your time and explained every step very clearly. Keep it up dude!

  • @shamiyafo
    @shamiyafo ปีที่แล้ว +6

    Great video. Your explanations were clear and easy to follow so coding along was a breeze. Keep the amazing content coming for us!

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

    Was looking for a video to break me out of my Authentication App bog, and your tutorial worked like a charm! Thanks again for your great content! I also enjoy the organic debugging process. See bug === bug goes boom. Love it! hahaha

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

    I like how fast you were explaining in a clear way the medular of the auth with firebase and react.

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

    You da best man! Had a project on hold for a month because I couldn't get this down. Keep up the good work!!

  • @Andrea-mm5yy
    @Andrea-mm5yy ปีที่แล้ว +1

    Best tutorial I ever watched. I love your voice, your pace and how well you explain things.

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

    I was stuck on the authentication of my project but your tutorial really came through, really, good, explanatory tutorial
    Thank you🙏✌️

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

    Thanks so much! This really helped me to understand the authentication process. I had been completely stuck and overwhelmed but this video really made sense and made it easy.

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

    One of the cleanest tutorials I've watched. Thanks for sharing your knowledge. Respect+

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

    Never have I seen such a great straight forward video. Thank you very much

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

    I came across your page early this week. You are doing a great job. Thank you ❤️

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

    Man you literally helped me get through my final project you're so great at explaining this kind of content shouldn't be free!!! but im happy it was free when I needed it!

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

      Thank you April! I’m just trying to help others learn and save time! 🙌

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

      Same here

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

    You’re amazing 🙌🏾
    I wish I found you earlier but all the same, I’m grateful😍

  • @JH-br4iv
    @JH-br4iv 2 ปีที่แล้ว

    This is gold, I was looking everywhere for a Firebase v9 / React auth tutorial ... oh and from a fellow Paramedic... Strong work, great channel, thank you!

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

      No way dude that’s awesome!! I still do some work as a medic - I love it (usually 😂)

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

    Awesome project for the beginner. Thanks, I really appreciate your work :)

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

    Duuuuuuuude!!! Whenever i see your new video i am so excited to learn some new stuff! Keep it going for us bro! I appreciate that. Thank you!

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

      Thanks dude! More to come!

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

    The best video on this topic on youtube right now. Subscribed. Keep it up man

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

    I will say just awesome dude ,i have been looking for this for past 2 days thanks 🙏

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

    Look, I don't think you know this, but your videos are SO clear and SO easy to understand. Keep it going, please!

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

    Underrated channel. I love watching the video and looking at the source code when I'm debugging. Save so much time as a result.

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

      Much appreciated! Thanks dude!

  • @codeshv4071
    @codeshv4071 8 หลายเดือนก่อน

    Best tutorial on Firebase Authentication, extremely clear!

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

    My dudeeee , am half through and this is eppiccc, thank you for sharing this

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

    thank you so much brother, the best video about this subject. there is nothing close to it and i've watched tons of it. keep explaining as you do, it''s great!

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

    Thank you , Your videos are a blessing !

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

    Bro your really good at guiding us through the coding, keep on going. You'll get 50k soon

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

    Your channel is going to blow up, just wait on it. Always pushing out relevant and fire content 🔥🔥

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

      Thank you dude!! I’m just trying to share what I’m learning.

  • @petren44
    @petren44 8 หลายเดือนก่อน

    Great video, straight to the point. Thank you so much!

  • @123BiB321
    @123BiB321 2 ปีที่แล้ว

    Thanks for you video, really helped me getting started with Firebase!

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

    The beauty of your channel is you explain all the things from scratch. Now I'm so confident that I don't have any question about firebase email pass authentication. Thank you so much. If possible make some project ( e-commerce, House rent, Restaurant etc ) using react tailwindCss and firebase .

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

      Thanks! More coming soon!

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

    wizard!!! thanks my men amazing video easy to follow and no bs, everything is clear

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

    Love how complete you make the videos, great tutorial

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

    Amazing tutorial, very clear and easy to follow with good explanations. Thanks!

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

    Thanks man! love your energy

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

    Love your tutorials! Keep doing more!

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

    great tutorial, love the aggressive breathing

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

    Clint is the goat. Best vids of updated react content.

  • @Isotope5000
    @Isotope5000 9 หลายเดือนก่อน

    Thank you very much sir. I can now protect any route I want.

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

    Legendary tutorial much appreciated. Buying you a virtual coffee! Tahnks mate

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

      MiVoodoo! Wow dude that’s so awesome! Thank you for supporting the channel. Much love!!

  • @rodrigo.bunhak
    @rodrigo.bunhak ปีที่แล้ว

    It was really a great tutorial, straight to the point! congrats!

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

    Just found this gem; you are awesome thank you!

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

    This is some God Level Tutorial.i have watched a lot of tutorials for firebase but did'nt get it but now❤❤❤❤❤

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

    Wow.. really helpful this video tutorials for beginners... can start quickly their career.. thank you so much sir..

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

    nice video as always!! cant wait to see ur channel turn 10k subs 🔥🔥

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

    Came across your channel accidentally and I like your style so subscribed :D. Although I haven't watch any your videos to the end but I hope I won't have to unsubscribe ;)

  • @HanSolo-hr4hz
    @HanSolo-hr4hz ปีที่แล้ว +1

    thanks sir this tutorial teach me a lot of new things that i want to put in my final project

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

      Thank you Han Solo!! Love the name too 💪

  • @youtubeshort_usa
    @youtubeshort_usa 5 หลายเดือนก่อน

    thanks man you really helped a lot

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

    Thank you so so much. This is the coolest thing ever!

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

    Great video man, thank you so much. Very well explained

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

    Thank you this was super helpful!

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

    This was great! Thanks.

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

    Very helpfull and easy to watch! Thanks man! 🙌🙌🙌

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

    Great video. Would be amazing to see a role-based authentication video up soon.

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

      Thank you! User admin role video coming!

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

    Thank you soo much for this video, could make my submission on time thanks to this.

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

    Thank you so much man, I've learned a lot from this video.

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

    Awesome tutorial, the context approach was truly inspiring! For the flashing content of your protected route, change the initial state of "user" to "null" instead of an empty object. That fixed it for me 💯

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

      Thank you for the feedback man - I was unaware. That’s what it’s about right there- we are all here to help each other. Much love! 💪

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

      Hugeeeee

  • @GH-pu3xc
    @GH-pu3xc ปีที่แล้ว

    Epic video! Thanks so much!

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

      Glad you liked it!

  • @89oka
    @89oka 2 ปีที่แล้ว

    Excellent!!! This is what I needed it.

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

    Really great video 😊

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

    I hope you read the comments
    Thanks for the simple explanation of this topic. Your channel is great and helps a lot. Submission 10 out of 10

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

      Sure do man! Much appreciated sir!

  • @sammy.2827
    @sammy.2827 2 ปีที่แล้ว

    thanks this was of great help 🙌

  • @markojovanovic165
    @markojovanovic165 7 หลายเดือนก่อน +1

    Great video! Hope you will get more followers.

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

      Thanks mark!

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

    You are the man for this video, thank you!

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

    Great video👍👍

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

    One of the best tutorial 🤘

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

    Boom! Liked and Subscribed :)

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

    Finally completed this tutorial! I love how natural how it is, errors?! Booom, we fix em together

  • @tharindulak
    @tharindulak 5 หลายเดือนก่อน

    thank you so much sir its very helpfull my university project

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

    Thx for the vid' gym bro !

  • @subramanyam.d24m56
    @subramanyam.d24m56 ปีที่แล้ว

    Thanks a lot for your clear explanation

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

    Bro you are by far the best and most easy to watch developer out there.....

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

      Thank you Ivan! Much appreciated!

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

      @@codecommerce thank you my man… I’m combining some parts to understand react much beter. You made me get my diploma, i made a pokemon application, and a criteria was “authentication” 👊🏽 i am wondering, are you gonna make a vid on how to deploy on firebase, and use some features like “test environments” to keep working on the application, as the mail app is still running on the cloud?

  • @StephBsimon
    @StephBsimon 10 หลายเดือนก่อน

    great stuff... thx a lot

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

    Great video

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

    Dude keep posting new videos
    I always learn something new !!
    please make a project on ecommerce (or just a shopping cart to get the feel of it ! )

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

    Thank you very much 💖

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

    Great Video!

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

    Great video ,I wish More

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

    this video alone worth the sub

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

    والله انك شيخ قومك ، يومين أجرب حل للتحديث الأخير و انت جبتها بكم دقيقه الله يسعدك يا شيخ thank you bro , you saved me

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

    Thank you mate

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

      Anytime man! Thanks for watching 🙏

  • @Wyrmidion
    @Wyrmidion ปีที่แล้ว +7

    good video, thanks ! i also got stuck at "createUser is not a function", between 33:45 and 35:40 you can see that at the latter , value={{createUser}} is written like so , but not earlier in the video, so if you were coding along, like me lol, others might get stuck there as it will likely not work until you get there. it might be helpful to point out the change?
    i still have to finish applying the code to my own page, but i hope i won't have any more problems now 😅 again, thanks for the vid !

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

      Thank you for this. Without you, I may still be trying to figure this one out.

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

    good job!

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

    thank you😍

  • @ilirbajrami2902
    @ilirbajrami2902 ปีที่แล้ว +4

    In the protected route, do:
    const navigate = useNavigate();
    if (!user) {
    navigate("/signin");
    }
    because if you do:
    if (!user) {
    return ;
    }
    it will send you to the signin page before the user "arrives" even though you are logged in

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

      Thank you my friend! I’ll make the update! Good catch :)

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

      Thanks. This fixed my app from logging out user after refreshing the page.

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

    Thanks! Boom!

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

    Thank you very much, you rule!

  • @JoaoPedro-vj1fj
    @JoaoPedro-vj1fj 2 ปีที่แล้ว

    Maannnnn you're so AMAZING, omg, thanks so much

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

    Thank you Very much

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

    you are number 1 !

  • @yuliaa.4741
    @yuliaa.4741 ปีที่แล้ว

    Thank you so much!

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

    nice that u made an updated version. In older tutorials you had to import firbase from "firbase/app" and i used to get errors because i was on the latest versions. Now you showed me initializeApp stuff, thx earned a sub

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

    Boom! Good stuff man

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

    tahnks very much

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

    thank you from Uzbekistan

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

      Uzbekistan- that’s awesome dude! 💪

  • @user-xm8xx1it4p
    @user-xm8xx1it4p 11 หลายเดือนก่อน

    Nice video. kindly make a video on role-based authentication react JS and Firebase

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

    Great tutorial! Really love it :)
    Got one question tho. In my case useEffect seems to fire twice, for example i got console.log firebase user object twice, also the null is being logged twice. Got any idea what might be a reason?

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

    Awesome video ++++++++++++++++++ 😃

  • @mustafa.celiktas
    @mustafa.celiktas ปีที่แล้ว

    Thank you so much

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

    Thank you

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

    very good !!! 🥰💯👍

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

    very good tutorial i tried a few more eventuly
    successed with this one