# Remove Auth

## **Disable Authentication Temporary**

Disabling authentication temporarily is generally not recommended due to security risks. However, if you have a specific scenario where you need to disable authentication for a short period, here are some steps you can follow:

1. Comment out the `AuthGuard` wrapper for the routes within the `DashboardLayout` element:

{% tabs %}
{% tab title="VITE (TS)" %}
{% code title="src/layout/Dashboard/index.tsx" %}

```typescript
// import AuthGuard from 'utils/route-guard/AuthGuard';

...
...
return (
  // <AuthGuard>
 <Box sx={{ display: 'flex', width: '100%' }}>
    <Header />
    ...
  </Box>
  // </AuthGuard>
)
```

{% endcode %}
{% endtab %}

{% tab title="VITE (JS)" %}
{% code title="src/layout/Dashboard/index.jsx" %}

```javascript
// import AuthGuard from 'utils/route-guard/AuthGuard';

...
...
return (
  // <AuthGuard>
 <Box sx={{ display: 'flex', width: '100%' }}>
    <Header />
    ...
  </Box>
  // </AuthGuard>
)
```

{% endcode %}
{% endtab %}
{% endtabs %}

In the code snippet above, the `<AuthGuard>` a component is commented out, allowing the routes within the `MainLayout` component to be rendered without authentication protection. To enable the AuthGuard wrapper again, remove the comment markers (`//`) surrounding the `<AuthGuard>` component.

## Remove Authentication Permanent

If you want to permanently remove authentication from a system or application, here are the steps to follow:

1. **Remove below authentication keys below from `.env` file.**

```json
...
.
## 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=

## AWS
VITE_APP_AWS_POOL_ID=
VITE_APP_AWS_APP_CLIENT_ID=

## Auth0
VITE_APP_AUTH0_CLIENT_ID=
VITE_APP_AUTH0_DOMAIN=
...
...
```

2. **Removed below list of files and directories.**

```markup
able-pro-react
..
├── src
│   ├── components\cards               
│   │   ├── AuthFooter.tsx
│   ├── context
│   │   ├── Auth0Context.tsx
│   │   ├── AWSCognitoContext.tsx
│   │   ├── FirebaseContext.tsx
│   │   ├── JWTContext.tsx
│   ├── hooks
│   │   ├── useAuth.ts
│   ├── pages
│   │   ├── auth (remove directory with all sub files)
│   ├── routes
│   │   ├── LoginRoutes.tsx
│   ├── sections
│   │   ├── auth (remove directory with all sub files)
│   ├── utils
│   │   ├── route-guard (remove directory with all sub files)
```

3. **Remove `LoginRoutes`** - Open file ./src/routes/index.tsx, and remove `LoginRoutes` import.

```typescript
routes/index.tsx

import { lazy } from 'react';
import { createBrowserRouter } from 'react-router-dom';

// project-import
import MainRoutes from './MainRoutes';
import ComponentsRoutes from './ComponentsRoutes';

import SimpleLayout from 'layout/Simple';
import Loadable from 'components/Loadable';

import { SimpleLayoutType } from 'config';

// render - landing page
const PagesLanding = Loadable(lazy(() => import('pages/landing')));

// ==============================|| ROUTING RENDER ||============================== //

const router = createBrowserRouter(
  [
    {
      path: '/',
      element: <SimpleLayout layout={SimpleLayoutType.LANDING} />,
      children: [
        {
          path: '/',
          element: <PagesLanding />
        }
      ]
    },
    ComponentsRoutes,
    MainRoutes
  ],
  { basename: import.meta.env.VITE_APP_BASE_NAME }
);

export default router; 
```

4. **Remove or change `/login` routes.**

* **If you want to remove routes**, remove the router component `RouterLink` or `Link` with `to=''` props.
* **If you want to change the URL**, set the home page URL like, `to={APP_DEFAULT_PATH}` , And import `APP_DEFAULT_PATH` from `config` file.

1. **the Remove `useAuth` hook** - Remove the below imports from throughout the project and set static values for user profile props.

   ```
   import useAuth from 'hooks/useAuth';
   ```
2. **Remove axios interceptors response from the ./src/utils/axios.ts file**

{% tabs %}
{% tab title="utils/axios.ts" %}

```typescript
import axios from 'axios';

// ==============================|| AXIOS - FOR MOCK SERVICES ||============================== //

const axiosServices = axios.create({ baseURL: process.env.VITE_APP_API_URL || 'http://localhost:3010/' });

export default axiosServices;
```

{% endtab %}
{% endtabs %}


---

# 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://phoenixcoded.gitbook.io/able-pro/react/how-tos/remove-auth.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.
