MCPcopy
hub / github.com/fastapi/fastapi / get_current_user

Function get_current_user

docs_src/security/tutorial003_an_py310.py:58–66  ·  view source on GitHub ↗
(token: Annotated[str, Depends(oauth2_scheme)])

Source from the content-addressed store, hash-verified

56
57
58async def get_current_user(token: Annotated[str, Depends(oauth2_scheme)]):
59 user = fake_decode_token(token)
60 if not user:
61 raise HTTPException(
62 status_code=status.HTTP_401_UNAUTHORIZED,
63 detail="Not authenticated",
64 headers={"WWW-Authenticate": "Bearer"},
65 )
66 return user
67
68
69async def get_current_active_user(

Callers

nothing calls this directly

Calls 3

DependsClass · 0.90
HTTPExceptionClass · 0.90
fake_decode_tokenFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…