Тёмный
No video :(

Firebase Authentication in React: A Step-by-Step Guide with Protected Routes 

from Dev To Prod
Подписаться 940
Просмотров 7 тыс.
50% 1

EXCLUSIVE CONTENT: bit.ly/3Oj8aCI
In this video tutorial, I will show you how to make an Authentication process in React JS using Firebase 9 and React Router 6.
⏱️ Timestamps:
00:00 - Intro
00:13 - Project setup
01:57 - Form creating
03:08 - Firebase setup
04:38 - Work with .env
05:15 - Creating Sign Up and Sign In methods
08:08 - Protected route
12:53 - Creating Sign Out method
Recommended Content:
useCallback and React.memo tutorial: • Learn UseCallback and ...

Опубликовано:

 

16 авг 2024

Поделиться:

Ссылка:

Скачать:

Готовим ссылку...

Добавить в:

Мой плейлист
Посмотреть позже
Комментарии : 33   
@topfeature4492
@topfeature4492 8 месяцев назад
Source code here: bit.ly/3N9AbMl Subscribe if you like our content!
@topfeature4492
@topfeature4492 8 месяцев назад
Timestamps: 00:00 - Intro 00:13 - Project setup 01:57 - Form creating 03:08 - Firebase setup 04:38 - Work with .env 05:15 - Creating Sign Up and Sign In methods 08:08 - Protected route 12:53 - Creating Sign Out method
@joeythompson4530
@joeythompson4530 8 месяцев назад
Best tutorial I have seen for this! Quick and easy!
@topfeature4492
@topfeature4492 8 месяцев назад
Glad to hear! Thanks for your support!
@mr.artist486
@mr.artist486 6 месяцев назад
You saved my day! this is perhaps the best tutorial I have ever seen on this topic!! Thanks a lot!!!!! ❤❤
@topfeature4492
@topfeature4492 6 месяцев назад
I'm really glad to read that! And I appreciate your support!
@mr.artist486
@mr.artist486 6 месяцев назад
@@topfeature4492 If possible, can you release a video tutorial on SSDLC (secure software development life cycle) best practices?
@JoshuaIsrael-sl8vt
@JoshuaIsrael-sl8vt 10 дней назад
Your a live saver, this eaxactly what l needed at the moment
@topfeature4492
@topfeature4492 9 дней назад
Glad to read that!
@ViciaiaTutorial
@ViciaiaTutorial 6 месяцев назад
you explained very simple and clear, thanks you for the tutorial!!!!
@topfeature4492
@topfeature4492 6 месяцев назад
I'm so happy you found it useful. Thanks!
@ViciaiaTutorial
@ViciaiaTutorial 6 месяцев назад
@@topfeature4492 wait to see more from you ^w^
@sethurk
@sethurk 7 месяцев назад
Pretty good. Short and precise. Thank you. subbed..
@topfeature4492
@topfeature4492 7 месяцев назад
Thanks for your support and subscribed!
@proflead
@proflead 4 дня назад
Nice guide! Thanks!
@topfeature4492
@topfeature4492 4 дня назад
Welcome!
@GenosoftTeamGen
@GenosoftTeamGen 3 месяца назад
Great work thank you this is super neat
@topfeature4492
@topfeature4492 3 месяца назад
Thank you for this comment!
@DiogoLScarmagnani
@DiogoLScarmagnani 4 месяца назад
Great tutorial, very quick and simple. It works a lot. Got subscribed. I have just one question, please: Don't we need to persist access token in storage for Firebase Authentication?
@topfeature4492
@topfeature4492 4 месяца назад
Glad to be helpful! What exactly storage did you mean?
@DiogoLScarmagnani
@DiogoLScarmagnani 4 месяца назад
@@topfeature4492 sorry. I mean localStorage.
@user-ul9km8jh1h
@user-ul9km8jh1h 6 месяцев назад
Hey, great video btw, how to change path when sign in true? For example email and password is true then when i click the button, how to show private page directly
@topfeature4492
@topfeature4492 6 месяцев назад
Hi! Thanks for your support! If I got you right, the explanation starts here: 12:09. You need to add to your homepage (or any other public page with Login form) an extra condition to check if a user already logged in (=== if the user exists). If so, Navigate the user to the private page, like this: return UPD Or you can do it directly in the Auth handler function I guess. You can simply create an instance like: const browserHistory = createBrowserHistory() And then just call browserHistory.push(location) after successful login
@Mohit-rl4ct
@Mohit-rl4ct 4 месяца назад
Amazing
@topfeature4492
@topfeature4492 4 месяца назад
Thanks for your comment!
@placek2390
@placek2390 3 месяца назад
how isfetching works? i dont understand why adding this magically solve the problem with rendering private page
@topfeature4492
@topfeature4492 3 месяца назад
We render a private route based on the user's existence, and the ProtectedRoute component receives it from the parent component as a prop. The default user value is null, so if we try to access the private page, we will be redirected to the home page because there is no user. After that, let's imagine, the user was successfully set on the state. As we know, this state is defined outside the Routes tree. It means, that the state change will NOT lead to a re-render routes tree. The tree will only update after URL changes. Because of that, the user value inside ProtectedRoute will always be null (withour re-rendering it could not get a new prop value). Even after state changing on the top level. So, my solution here is to render the routes tree only when the user already exists. While we're fetching users asynchronously (isFetching === true) we want to return the loading component (not the routes tree). When the user is fetched we set it to state, then, set isFetching === false, and only after that we are returning a routes tree. It will be the first render and the user value will be correct at this moment.
@xczm225
@xczm225 5 месяцев назад
how you guys deal with view flashes when you are logged out and trying to get to any private route? for me it renders component for 0.1 sec and sends you back to '/'
@topfeature4492
@topfeature4492 5 месяцев назад
Hi! I tried to reproduce this behavior using my codebase, and everything seems to work correctly. You can compare your code with the following example github.com/from-dev-to-prod/react-firebase-auth Or, please, provide an example and I may be able to help.
@peacemelodi1145
@peacemelodi1145 7 месяцев назад
Nice content are you on Instagram sir
@topfeature4492
@topfeature4492 7 месяцев назад
Thank you! Not at the moment, but I’ll post a link when I do
@ig_strawhats_
@ig_strawhats_ 4 месяца назад
please can you make vedio of user and admin login in one project
@topfeature4492
@topfeature4492 4 месяца назад
I guess I can try!
Далее
Custom Protected Route Component in React
10:58
Просмотров 41 тыс.
Classic Italian Pasta Dog
00:20
Просмотров 2,8 млн
до/после Знакомо?
00:16
Просмотров 14 тыс.
User Authentication with React & Firebase: Full Tutorial
1:03:35
I forced EVERYONE to use Linux
22:59
Просмотров 355 тыс.
The Story of Next.js
12:13
Просмотров 563 тыс.