Home / Function/ login() — fastapi Function Reference

login() — fastapi Function Reference

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

Entity Profile

Dependency Diagram

graph TD
  a515b465_8166_7f2e_3430_ccfaa4bd6ab1["login()"]
  75cfd1a5_0803_efc1_bd73_03fd35666bbc["tutorial003_py39.py"]
  a515b465_8166_7f2e_3430_ccfaa4bd6ab1 -->|defined in| 75cfd1a5_0803_efc1_bd73_03fd35666bbc
  5f1f2854_c744_0427_f007_f2670beab75f["fake_hash_password()"]
  a515b465_8166_7f2e_3430_ccfaa4bd6ab1 -->|calls| 5f1f2854_c744_0427_f007_f2670beab75f
  style a515b465_8166_7f2e_3430_ccfaa4bd6ab1 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

docs_src/security/tutorial003_py39.py lines 76–85

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_py39.py.
Where is login() defined?
login() is defined in docs_src/security/tutorial003_py39.py at line 76.
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