# Switch to Firebase

### **JWT to Firebase**

**Set Firebase Config**

At present, firebase uses you need to set a secret in the following file. For more detail refer to firebase here: <https://firebase.google.com/docs/reference/rest/auth>

{% code title=".env" %}

```javascript
...
###
## Firebase - Google Auth 

REACT_APP_FIREBASE_API_KEY=
REACT_APP_FIREBASE_AUTH_DOMAIN=
REACT_APP_FIREBASE_PROJECT_ID=
REACT_APP_FIREBASE_STORAGE_BUCKET=
REACT_APP_FIREBASE_MESSAGING_SENDER_ID=
REACT_APP_FIREBASE_APP_ID=
REACT_APP_FIREBASE_MEASUREMENT_ID=
###
...
```

{% endcode %}

**Change AuthProvider**

{% code title="..\src\App.js" %}

```javascript
import { FirebaseProvider as AuthProvider } from 'contexts/FirebaseContext';
```

{% endcode %}

**Change auth Hooks**

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

{% code title="..\src\hooks\useAuth.js" %}

```javascript
import AuthContext from 'contexts/FirebaseContext';
```

{% endcode %}

#### Copy login code

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

* **From:** `src\sections\auth\login\FirebaseLogin`
* **To:** `src\sections\auth\auth-forms\AuthLogin.js`

#### Copy register code

We have provided a code that just needs to be replaced.&#x20;

* **From:** `src\sections\auth\register\FirebaseRegister`
* **To:** `src\sections\auth\auth-forms\AuthRegister.js`

{% hint style="info" %}
**For nextJS**, refer next-auth site: [`https://authjs.dev/reference/core/providers_google`](https://authjs.dev/reference/core/providers_google)
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://codedthemes.gitbook.io/mantis/v3.0.0/authentication/switch-to-firebase.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
