# Switch to JWT

### **Firebase to** JWT

**Set JWT Config**

At present, JWTuses a dummy backend call, so we don't need any secret, but in actual implementation, you need to set a secret in the following file. For more detail refer to JWT here: <https://jwt.io/introduction>

{% code title=".env" %}

```javascript
...
REACT_APP_JWT_SECRET_KEY=
REACT_APP_JWT_TIMEOUT=
...
```

{% endcode %}

**Change AuthProvider**

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

```javascript
import { JWTProvider as AuthProvider } from 'contexts/JWTContext';
```

{% endcode %}

**Change auth Hooks**

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

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

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

{% 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\JWTLogin`
* **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\JWTRegister`
* **To:** `src\sections\auth\auth-forms\AuthRegister.js`


---

# 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/v2.0.0/authentication/switch-to-jwt.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.
