Able Pro
React
React
  • ✨Overview
  • 🌱Pre-requisites
  • 🚀Quick Start
  • 📂Folder Structure
  • 🌀State Management
  • 🔒Authentication
    • Switch to Auth0
    • Switch to Firebase
    • Switch to AWS Cognito
  • 🛣️Routing
  • 📡Axios API Calls
  • 🌐Internationalization
  • 🎭Theme/Style Configuration
  • 🎨Color Presets
  • 🛠️Project Configuration
  • 📚How to's
    • Login as First Page
    • Dashboard as First Page
    • Render Menu from the backend
    • Remove menu render from Backend
    • Remove Auth
  • 🤝Integration
    • Seed
    • Comparison
  • 📦Dependencies
  • 🖌️Figma
  • 🆘Support
  • 🗓️Roadmap
  • 📅Changelog
Powered by GitBook
On this page
  1. Authentication

Switch to Firebase

PreviousSwitch to Auth0NextSwitch to AWS Cognito

Last updated 2 months ago

JWT to Firebase

  1. Set Firebase Config

At present, firebase uses you need to set a secret in the following file. For more detail refer to Firebase here:

.env
...
###
## Firebase - Google Auth 

VITE_APP_FIREBASE_API_KEY=
VITE_APP_FIREBASE_AUTH_DOMAIN=
VITE_APP_FIREBASE_PROJECT_ID=
VITE_APP_FIREBASE_STORAGE_BUCKET=
VITE_APP_FIREBASE_MESSAGING_SENDER_ID=
VITE_APP_FIREBASE_APP_ID=
VITE_APP_FIREBASE_MEASUREMENT_ID=
###
...
  1. Change AuthProvider

src/App.txs
import { FirebaseProvider as AuthProvider } from 'contexts/FirebaseContext';
src/App.jxs
import { FirebaseProvider as AuthProvider } from 'contexts/FirebaseContext';
  1. Change auth Hooks

Comment another context in the following file and uncomment the Firebase one.

src/hook/useAuth.ts
import AuthContext from 'contexts/FirebaseContext';
src\hook\useAuth.js
mport AuthContext from 'contexts/FirebaseContext';
  1. Copy login code

It's also super simple. We have provided a code that just needs to be replaced.

  • From: src\sections\auth\login\FirebaseLogin

  • To: src\sections\auth\auth-forms\AuthLogin.tsx

  • From: src\sections\auth\login\FirebaseLogin

  • To: src\sections\auth\auth-forms\AuthLogin.jsx

  1. Copy the Register Code

We have provided a code that just needs to be replaced.

  • From: src\sections\auth\register\FirebaseRegister

  • To: src\sections\auth\auth-forms\AuthRegister.tsx

  • From: src\sections\auth\register\FirebaseRegister

  • To: src\sections\auth\auth-forms\AuthRegister.jsx

🔒
https://firebase.google.com/docs/reference/rest/auth