# 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="NEXT(TS)" %}
{% code title="src/app/(dashboard)/layout.tsx" %}

```typescript
// project-imports
import DashboardLayout from 'layout/DashboardLayout';
// import AuthGuard from 'utils/route-guard/AuthGuard';

// ==============================|| DASHBOARD LAYOUT ||============================== //

export default function Layout({ children }: { children: React.ReactNode }) {
  return (
    // <AuthGuard>
          <DashboardLayout>{children}</DashboardLayout>
    // </AuthGuard>
  );
}
```

{% endcode %}
{% endtab %}

{% tab title="NEXT(JS)" %}

<pre class="language-javascript" data-title="src/app/(dashboard)/layout.jsx"><code class="lang-javascript">// project-imports
import DashboardLayout from 'layout/DashboardLayout';
<strong>// import AuthGuard from 'utils/route-guard/AuthGuard';
</strong>
// ==============================|| DASHBOARD LAYOUT ||============================== //

export default function Layout({ children }) {
  return (
    // &#x3C;AuthGuard>
          &#x3C;DashboardLayout>{children}&#x3C;/DashboardLayout>
    // &#x3C;/AuthGuard>
  );
}
</code></pre>

{% endtab %}
{% endtabs %}

In the code snippet above, the `<AuthGuard>` a component is commented out, allowing the routes within the `DashboardLayout`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 remove authentication from a system or application permanently, here are the steps to follow:

1. Remove below authentication keys below from **`next.config.js`** file.

{% code title="next.config.js" %}

```javascript
...
.
NEXT_APP_JWT_SECRET: 
NEXT_APP_JWT_TIMEOUT: 
NEXTAUTH_SECRET_KEY: 

```

{% endcode %}

2. Removed below list of files and directories.

{% code title="" %}

```typescript
├── src
│   ├── app       
│   │   ├── auth (remove directory with all sub files)
│   │   ├── api (remove directory with all sub files)
│   ├── views
│   │   ├── authentication (remove directory with all sub files)
│   │   ├── auth (remove directory with all sub files)
│   ├── sections
│   │   ├── auth (remove directory with all sub files)
│   ├── utils
│   │   ├── route-guard (remove directory with all sub files)
│   │   ├── authOptions.ts
```

{% endcode %}

3. Commented out the full file **`./src/utils/axios.ts`**
4. Remove or change **`/login`** routes.
   * **If you want to remove routes**, remove the router component  `Link` with `href=''` props.
   * **If you want to change url**, set the home page URL like, `to={APP_DEFAULT_PATH}` , And import `APP_DEFAULT_PATH` from `config` file.


---

# 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/nextjs/how-to/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.
