DEV Community

Cover image for React authentication with Firebase

React authentication with Firebase

Dawx on October 21, 2021

Hello everyone, in this guide I will show you how to set up basic authentication in React with Firebase. We will be also using react-router for cre...
Collapse
 
robin_beaudru_fd2d58ef438 profile image
Robin Beaudru

Thank you very much for your article!
I couldn't setup Firebase auth except with your tutorial!

How can I display, let's say the user email?
Cheers!

Collapse
 
dawx profile image
Dawx

Hi, you can get current users details with auth.currentUser, to display an email address you can do something like this: <p>{auth.currentUser.email}</p>

Hope this helps!

Collapse
 
robin_beaudru_fd2d58ef438 profile image
Robin Beaudru

Thank you I succeed exactly the same way!

Iā€™m very new to programming, and even if login is a basic feature, it is really hard to learn !

I shared this tutorial to all of my boot camp colleagues!

Collapse
 
karthiknayak98 profile image
KarthikNayak

How to use Firebase Firestore with Redux-toolkit?

Collapse
 
dawx profile image
Dawx

Hi, unfortunately I'm not familiar with Firestore, this article is only about authentication which doesn't require Firestore, you can use any other database with this setup

Collapse
 
diegogonzalezcruz profile image
Diego G. Cruz

What do you wanna do?

Collapse
 
diegogonzalezcruz profile image
Diego G. Cruz

Hi, I'm using your useEffect code, and I get : Error: Invalid hook call. Hooks can only be called inside of the body of a function component.

Collapse
 
dawx profile image
Dawx

Hi, if you tried to manually copy code from here, it is possible that you pasted it in wrong place, you can check repository and compare the difference github.com/PDavor/react-firebase

Collapse
 
diegogonzalezcruz profile image
Diego G. Cruz • Edited

Thanks, I fixed it!

Collapse
 
tuenguyen2911_67 profile image
Tue

This article helps! <3

Collapse
 
medaminefh profile image
Mohamed Amine Fh

Great Article ā¤

Collapse
 
dawx profile image
Dawx

Thank you very much :)