# Protecting Routes

* Next step is to protect the routes, meaning that the user has to be logged in, in order to be able to perform certain operations
* To do that we will have to modify the function parameters:

```python
def delete_post(id: int, db: Session = Depends(get_db), user_id: int = Depends(oauth2.get_current_user)):
```

* So all this does really, is that it sets up the <mark style="color:orange;">`get_current_user`</mark> function as a dependency meaning that the user has to be logged in


---

# 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.arkannis.net/programming/python/frameworks/fastapi/protecting-routes.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.
