Home / Function/ login() — fastapi Function Reference

login() — fastapi Function Reference

Architecture documentation for the login() function in tutorial003_py310.py from the fastapi codebase.

Entity Profile

Dependency Diagram

graph TD
  f097115f_d5de_9f52_2807_b701d20c32df["login()"]
  4f39871a_1e67_94a0_13d5_0e43be35c82a["tutorial003_py310.py"]
  f097115f_d5de_9f52_2807_b701d20c32df -->|defined in| 4f39871a_1e67_94a0_13d5_0e43be35c82a
  1366beff_01f3_15ad_258d_a3e60a31bf41["fake_hash_password()"]
  f097115f_d5de_9f52_2807_b701d20c32df -->|calls| 1366beff_01f3_15ad_258d_a3e60a31bf41
  style f097115f_d5de_9f52_2807_b701d20c32df fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

docs_src/security/tutorial003_py310.py lines 74–83

async def login(form_data: OAuth2PasswordRequestForm = Depends()):
    user_dict = fake_users_db.get(form_data.username)
    if not user_dict:
        raise HTTPException(status_code=400, detail="Incorrect username or password")
    user = UserInDB(**user_dict)
    hashed_password = fake_hash_password(form_data.password)
    if not hashed_password == user.hashed_password:
        raise HTTPException(status_code=400, detail="Incorrect username or password")

    return {"access_token": user.username, "token_type": "bearer"}

Domain

Subdomains

Frequently Asked Questions

What does login() do?
login() is a function in the fastapi codebase, defined in docs_src/security/tutorial003_py310.py.
Where is login() defined?
login() is defined in docs_src/security/tutorial003_py310.py at line 74.
What does login() call?
login() calls 1 function(s): fake_hash_password.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free