# Route Protection

Route protection means protecting any defined path from unauthorized access. For example, Signin or Signup pages are common paths/unrestricted paths and any user can access it. However there are many paths or pages that only loggedin users can access, those paths are called Protected Routes. In Crema, we have provided the functionality of route protection, you have to follow the following steps to protect the route:-

Go to the file, where the routes have been declared. For example, let's go to the dashboard file where the dashboard related routes have been declared, the file can be found at:-

```
src/modules/dashboard/index.js
```

While declaring the route, you have to pass one extra property named "auth" in route object in order to make the route protected.

![](/files/-M3Zy3LPamfgd3t2g-t5)

If this 'auth' property is added, this route will be protected and requires a loggedin user to access this path and if this property is not passed, then this path is directly accessible without any condition.


---

# 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://docs.cremawork.com/v1.0/route-protection.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.
