React Authentication Crash Course (with Firebase v9)

Sdílet
Vložit
  • čas přidán 27. 07. 2024
  • Sign up, log in, and log out users with Firebase Authentication from your front end React Application.
    (Web v9 Modular)
    The code used in this video:
    github.com/LogicismX/React-Fi...
    Firebase Auth Documentation:
    firebase.google.com/docs/auth...
    Firebase Auth Playlist:
    • React Authentication C...
    Timestamps:
    00:00 - Demo
    00:39 - Firebase Setup
    03:20 - Auth Setup
    03:50 - Signup Users
    10:23 - onAuthStateChange (useAuth + currentUser)
    16:10 - Logout Users
    19:14 - Login Users
    20:55 - Weak Password Error
  • Věda a technologie

Komentáře • 111

  • @monique2839
    @monique2839 Před 2 lety +6

    I just want you to know, you have one of THE BEST firebase tutorials with react on youtube. I always recommend people to your channel when they are getting started with Firebase. I love your teaching style! Everything is clear and well explained and you get straight to the point. Please please please continue to make more videos like this and just content in general. I really appreciate it !!!

    • @ravenjs
      @ravenjs  Před rokem +2

      @Monique I'm so happy that I was able to add value to you. It means a lot.

  • @martincastroar
    @martincastroar Před rokem +2

    Thank you. The same a lot of videos explain in really difficult ways, you resolve it in 22 mins. I am lucky I decided to look for more videos and found this one. Thanks!!

  • @ToshisanMotonaka
    @ToshisanMotonaka Před 2 lety +3

    Great video it really helped me out, I didn't quit understand the difference between v8 and v9! Keep up the content great explanation!

  • @lesmoe524
    @lesmoe524 Před 2 lety +3

    Amazing video, you showed so much great stuff in 22 minutes. Thank you.

  • @ayushvarma9657
    @ayushvarma9657 Před 2 lety +2

    Nice video, short and crisp!
    Much all we need!

    • @ravenjs
      @ravenjs  Před rokem +1

      glad you liked it :))

  • @zhanezar
    @zhanezar Před 2 lety +2

    just wanted to say thank you , this helped me with a problem with Firebase

  • @leaningtower73
    @leaningtower73 Před 2 lety +2

    Great content, thanks!
    Guys if you only want the name of the current user in 'Currently logged in as:' you can write
    Currently logged in as: {currentUser ? currentUser?.email.split("@")[0] : "Guest"}

  • @heyiamigor
    @heyiamigor Před 2 lety +1

    Great video! Looking forward to the next video on auth

  • @morphine496
    @morphine496 Před 2 lety +2

    You really helped me, i've had trouble with monitoring the auth state. Thanks a lot!

    • @ravenjs
      @ravenjs  Před rokem +1

      glad i was able to help :))

  • @tomasgilamoedo8301
    @tomasgilamoedo8301 Před 2 lety +2

    Excellent video bro! really appreciated

  • @bigchhet
    @bigchhet Před 2 lety +1

    Thank you for creating this video! it has helped me so much

  • @learnwithjoe8117
    @learnwithjoe8117 Před 2 lety +2

    thanks for this! patiently waiting for your next video =))

    • @ravenjs
      @ravenjs  Před 2 lety +1

      thank you somuch for your enthusiasm Joe :)) i've been super duper busy these few weeks and i've been dying to make a new video. i still am. thx for ur patience and sory for the delay :(

  • @ashifali1326
    @ashifali1326 Před 2 lety +2

    really helpful great job bro

  • @majdshaheen8136
    @majdshaheen8136 Před rokem +2

    straight to the point easy and simple and understandable , Thanks

  • @Thelandoftheartist
    @Thelandoftheartist Před rokem +2

    It was a very useful explanation. thank you

  • @nicolepozo3610
    @nicolepozo3610 Před 2 lety +3

    You read my mind 😂 thank u so much for all the good videos

    • @ravenjs
      @ravenjs  Před 2 lety +1

      thas 'cause im secretly a psychic 🤫

  • @abdulazizmashrabov6399
    @abdulazizmashrabov6399 Před rokem +2

    You saved me so much time. thank you

  • @trevorscott7316
    @trevorscott7316 Před rokem +2

    Very nice tutorial!

  • @thebigbull4213
    @thebigbull4213 Před rokem +2

    Short but sweet thank brt

  • @camilovegag
    @camilovegag Před 2 lety +2

    Just finished your last playlist, will check this video! Waiting for the search bar functionality you replied to a comment :)

    • @ravenjs
      @ravenjs  Před 2 lety +1

      thanks @Camilo! About the search bar, you're talking about the Firestore playlist right?

    • @camilovegag
      @camilovegag Před 2 lety +2

      Yes, that one!

  • @user-jp7ss3mn9f
    @user-jp7ss3mn9f Před 2 lety +2

    Awesome!! This solved my problems

  • @SalmanShah95
    @SalmanShah95 Před 2 lety +3

    Worked
    Finally!.

  • @burakdemir6601
    @burakdemir6601 Před 2 lety +5

    literally best firebase authentication,thank you my man
    keep up the good work

    • @ravenjs
      @ravenjs  Před 2 lety +1

      i'm flaterred, thank you so much @Burak Demir :))

  • @sharkman6434
    @sharkman6434 Před 2 lety +2

    thank you for you job and videos !!

  • @user-hw9rp6wn8l
    @user-hw9rp6wn8l Před 2 lety +2

    Thanks for this hard theme

  • @Rene-mg9eg
    @Rene-mg9eg Před 2 lety +4

    Great video! Keep up the good content 🔥
    Would be nice if you can make a video how to create profildata in firestore and connect them to the userid frim firebase authentication.
    Im stuck at this at the moment because im an absolute beginner and the logic is kinda tricky for me .😬

    • @ravenjs
      @ravenjs  Před 2 lety +4

      @Rene you are on point! I'm definitely making videos on how to use Cloud Firestore with Firebase Auth in conjunction. thx for this brilliant suggestion too!

    • @nagweentareq7536
      @nagweentareq7536 Před 2 lety +1

      @@ravenjs did you make the video or not yet ?

  • @merakli2022
    @merakli2022 Před 2 lety +2

    Awesome. Keep it up.

  • @mohamedmrabet4814
    @mohamedmrabet4814 Před 2 lety +3

    This is gold!

    • @ravenjs
      @ravenjs  Před 2 lety +1

      haha thank you so much for this amazing comment :))

  • @mohamedyoussef8835
    @mohamedyoussef8835 Před 2 lety +2

    Awesome video +++++++++++++++++++ Thank you.

  • @fr3847
    @fr3847 Před 2 lety +2

    great tutorial!

  • @amrmahmoud3082
    @amrmahmoud3082 Před 2 lety +2

    Thanks alot bro

  • @AdAm-yn1ov
    @AdAm-yn1ov Před 2 lety +2

    Thanks man 🙂

    • @ravenjs
      @ravenjs  Před 2 lety +1

      you're most welcome :)

  • @altcoinalpha
    @altcoinalpha Před rokem +2

    great tutorial. but why is it when I make sign up 1 account, log out, then try to make a new account, i keep getting the error warning? if i try to log in with the initial account, it works, but if i make a 2nd account it keeps getting errors until i close the window, terminal & visual studio code... then open vsc and run npm start again ... then im able to make a different account.. anyone know why?

  • @bilelrahmouni01
    @bilelrahmouni01 Před 2 lety +2

    thank you!!

  • @Ramenmemes
    @Ramenmemes Před 2 lety +2

    goat tutorial. really helped me

    • @ravenjs
      @ravenjs  Před 2 lety +1

      goat? 🤣 xD

    • @Ramenmemes
      @Ramenmemes Před 2 lety +1

      @@ravenjs greatest of all time

    • @ravenjs
      @ravenjs  Před 2 lety +1

      @@Ramenmemes sensei you just taught me something new today. Thank you sm

    • @Ramenmemes
      @Ramenmemes Před 2 lety +1

      @@ravenjs UwU

  • @areej8934
    @areej8934 Před rokem +1

    I'm having an issue. when I click on signup the data I filled in appears in the url of my page. page gets refreshed with that url and no data saved In firebase. I don't know what's wrong with it

  • @Kaze919
    @Kaze919 Před 2 lety +1

    What about reauthentication? How do we get the credentials?

  • @baldmannnnn
    @baldmannnnn Před 2 lety +2

    Hi! I learned a lot from your tutorials and I implement it it my app. I am using React, Firebase and Redux for my state management. So far I was able to implement the authentication but I have problem on how to sync my navigation when after login/sign up in react firebase. I am using react-router in my navigation but the login, signup still shows up a split seconds before it get removed.
    My state looks like this -> user: null, isLoading: false. But the action to switch isLoading to true is always the first to finish and action to save the user is always the last. Can you give me some tip to fix this issue? Should I just set a delay to sync the 2 states?

    • @ravenjs
      @ravenjs  Před 2 lety +1

      how are you implementing the loading state? are you using an async function?

  • @youtubeguyHi
    @youtubeguyHi Před 2 lety +3

    Would you be able to make a video covering user roles with Firebase and React?

    • @ravenjs
      @ravenjs  Před 2 lety +2

      @Cian Kelly thank you so much for this amazing suggestion. I'll note it down!

  • @pixelerator1543
    @pixelerator1543 Před 2 lety +2

    is useRef replacing the onChange={event.target.value} ?

    • @ravenjs
      @ravenjs  Před 2 lety +2

      yes! you are absolutely correct :))

  • @oussamaabdallah5856
    @oussamaabdallah5856 Před 2 lety +3

    can u please make a video about react-redux firebase v9 I had searched all the net but i didn't find any updated guide? thanks

    • @ravenjs
      @ravenjs  Před 2 lety +1

      Do you mean react-redux with Firebase Authentication or Cloud Firestore?

    • @oussamaabdallah5856
      @oussamaabdallah5856 Před 2 lety +2

      ​@@ravenjs ohh thanks for the fast reply ! i mean with cloud firestore i worked with react-redux-firebase but now they didnt update the package with the v9 new syntaxe and methods , i dont know if there is an other tool , you will be the first one talk about redux and firebase v9 🔥

    • @ravenjs
      @ravenjs  Před 2 lety +1

      @@oussamaabdallah5856 ahh. so you wanna store the data fetched from firestore inside of redux? if this is the case, it's pretty easy to implement this, i'll definitely make a video about it. i just wanna make sure i understood ur question completely b4 making the video :)

  • @dmitruz1900
    @dmitruz1900 Před 2 lety +2

    I have an error Uncaught TypeError: (0 , _firebase__WEBPACK_IMPORTED_MODULE_1__.useAuth) is not a function

    • @ravenjs
      @ravenjs  Před 2 lety +1

      you could try removing node_modules and reinstall all the npm packages again?

    • @dmitruz1900
      @dmitruz1900 Před 2 lety +1

      @@ravenjs I did not try it yet

  • @Jb67912
    @Jb67912 Před 2 lety +2

    Yeah but how do u get those input values to clear after submitting??

    • @ravenjs
      @ravenjs  Před 2 lety +1

      you might wanna change to using controlled fields in React for more advanced features like this. i chose useRef here simply because it was the cheapest and dirtiest way to get going with input fields in react xD

  • @cyliaalileche6445
    @cyliaalileche6445 Před 2 lety +2

    bravoooooooooooooooooo

    • @ravenjs
      @ravenjs  Před 2 lety +1

      thank youuuuuuuuuuuuuuuu

  • @supercrunch3367
    @supercrunch3367 Před 2 lety +2

    How can we add Firstname and Lastname fields?

    • @ravenjs
      @ravenjs  Před 2 lety +3

      @Super Crunch, to store user-related data, you'll need to use firebase auth in conjunction with firebase/firestore. I have a whole playlist about Firestore if you need it, but the simple answer is:
      create a user document in Firebase/Firestore, give it a field called userID, and store the Firebae Auth userID in the Firestore document. Then, you can also store other user-related info like the firstname and lastname fields in the cloud firestoredatabase

  • @ANAS-md4vp
    @ANAS-md4vp Před rokem

    when I try to signup I get this message: Possible Unhandled Promise Rejection:
    FirebaseError: Firebase: Error (auth/admin-restricted-operation).
    FirebaseError: Firebase: Error (auth/admin-restricted-operation).

  • @danielodiase6824
    @danielodiase6824 Před 2 lety +2

    Hey would you be able to make vids on private routes

    • @ravenjs
      @ravenjs  Před 2 lety +1

      yes @Daniel Odiase thank you so much for this suggestion. I plan on making a video to show how to create user roles and private routes using react-router-dom

  • @user-gw4bk5xs5o
    @user-gw4bk5xs5o Před 10 měsíci

    Bro Firebase is a like Backend?

  • @alisafaa140
    @alisafaa140 Před 2 lety +2

    can you make send notification firebase v9 with react.js

    • @ravenjs
      @ravenjs  Před 2 lety +1

      hey @Ali!
      Yes, I believe you can get push notifications with Firebase and ReactJS:
      firebase.google.com/docs/cloud-messaging/js/client
      I will need to make a specific video to cover this topic, thanks a million for this amazing suggestion :))

  • @SalmanShah95
    @SalmanShah95 Před 2 lety +3

    Also make authentication tutorial on phone number and other providers..
    🙂

    • @ravenjs
      @ravenjs  Před 2 lety +2

      yes great idea! tq

    • @SalmanShah95
      @SalmanShah95 Před 2 lety +2

      @@ravenjs most welcome..
      And I am waiting for this..

  • @noahperrin9905
    @noahperrin9905 Před 2 lety +2

    hey sorry are you french? nice video thanks ;)

  • @jetix111
    @jetix111 Před 2 lety +2

    Thanks for your help any discord server to help junior devs ?

    • @ravenjs
      @ravenjs  Před 2 lety +1

      not yet...for now. our community is not nearly as big yet, but if you need any help you can just put them in the yt comments at the moment :) thx for your enthusiasm though

  • @draq_
    @draq_ Před 2 lety +2

    thanks for this please do make the video for updating email and password soon

    • @ravenjs
      @ravenjs  Před 2 lety +1

      hey @Abdullah Abdulfatah thanks for the encouragement :)) i'll do my best

    • @draq_
      @draq_ Před 2 lety +2

      @@ravenjs I don't mean to disturb you but i am currently facing the issue right now for the assessment of the job i applied for
      Not so much luck so far

    • @draq_
      @draq_ Před 2 lety +2

      @@ravenjs The value of the input changes by one letter and it just throws an error and sends me a notification mail for the letter that changed, I'm going crazy right now

    • @ravenjs
      @ravenjs  Před 2 lety +1

      ​@@draq_ whee calm down brotha :) did you manage to solve this issue?

    • @ravenjs
      @ravenjs  Před 2 lety +1

      @@draq_ hey I'm all ears. how can i help you?

  • @supermammal17
    @supermammal17 Před 2 lety +2

    Love the video but create a .env file to hide the api credentials

    • @ravenjs
      @ravenjs  Před 2 lety +1

      yea haha i'll be removing the firebase project soon

  • @avinashsudhanshu
    @avinashsudhanshu Před 2 lety +2

    thanks for the video, your second video is hidden

    • @ravenjs
      @ravenjs  Před 2 lety +2

      no wayy, how did you know 😉😏

  • @ReVoX161
    @ReVoX161 Před 2 lety +1

    At 15 : 00 :
    when i did the question mark at currentuser : Currently logged in as : { currentUser?.email} . the code after this one all became red , still suprsingly works . is there something wrong ?

    • @ravenjs
      @ravenjs  Před 2 lety +2

      "the code becoming red" is really subjective to which linter or IDE you are using and how you configure it, so yea it depends

  • @packo2004
    @packo2004 Před 2 lety +2

    How to auto log out when the user closed the browser or the tab?

    • @ravenjs
      @ravenjs  Před 2 lety +2

      Good question. In Firebase Auth, thers 3 types of auth state persistence: 'local', 'session' and 'none'. You can find more details in the docs i've linked below, and also you can use
      setPersistence(auth, browserSessionPersistence)
      Auth State Persistence Docs:
      firebase.google.com/docs/auth/web/auth-state-persistence#modifying_the_auth_state_persistence