This project was inspired by Web Dev Simplified on YouTube, which made a tutorial about Firebase V8. So I updated it for Firebase V9 and added some cool features like auto-redirect when a user is logged in and trying to access the login page.
Perfect to quickstart any new project which needs user authentication!
- User authentication with Firebase V9
- Auto-redirect when a user is logged in and trying to access the login page
- Easy setup with just a
.env.local
file for Firebase credentials
The only thing you have to do is create a .env.local
file with your Firebase credentials in your project directory.
- Clone the repository to your local machine.
- Create a new Firebase project on the Firebase console.
- Go to the project settings and copy the Firebase configuration.
- Create a
.env.local
file in the root of the project directory. - Paste the Firebase configuration into the
.env.local
file and save it. It should look something like this:
REACT_APP_FIREBASE_API_KEY=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
REACT_APP_FIREBASE_AUTH_DOMAIN=your-app-name.firebaseapp.com
REACT_APP_FIREBASE_PROJECT_ID=your-app-name
REACT_APP_FIREBASE_STORAGE_BUCKET=your-app-name.appspot.com
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=xxxxxxxxxxxx
REACT_APP_FIREBASE_APP_ID=1:xxxxxxxxxxxx:web:xxxxxxxxxxxxxxxx
- Install the dependencies by running
npm install
. - Run the app with
npm start
.
That's it! You should now have a fully functioning Firebase Authentication V9 system in your app.
If you find any issues with the code or have any suggestions for improvements, feel free to submit a pull request.
This project is licensed under the MIT License. See the LICENSE
file for details.