docs/en/docs/reference/dependencies.md MARKDOWN 30 lines View on github.com → Search inside
1# Dependencies - `Depends()` and `Security()`23## `Depends()`45Dependencies are handled mainly with the special function `Depends()` that takes a callable.67Here is the reference for it and its parameters.89You can import it directly from `fastapi`:1011```python12from fastapi import Depends13```1415::: fastapi.Depends1617## `Security()`1819For many scenarios, you can handle security (authorization, authentication, etc.) with dependencies, using `Depends()`.2021But when you want to also declare OAuth2 scopes, you can use `Security()` instead of `Depends()`.2223You can import `Security()` directly from `fastapi`:2425```python26from fastapi import Security27```2829::: fastapi.Security

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.

Generated by searchcode.com · powered by code_get_file + code_get_findings