Browse Source

Use HTTPBasic authenticate headers in tutorial007

pull/14647/head
westinjiang 6 months ago
parent
commit
a30c7d222f
  1. 2
      docs_src/security/tutorial007_an_py39.py
  2. 2
      docs_src/security/tutorial007_py39.py

2
docs_src/security/tutorial007_an_py39.py

@ -26,7 +26,7 @@ def get_current_username(
raise HTTPException( raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED, status_code=status.HTTP_401_UNAUTHORIZED,
detail="Incorrect username or password", detail="Incorrect username or password",
headers={"WWW-Authenticate": "Basic"}, headers=security.make_authenticate_headers(),
) )
return credentials.username return credentials.username

2
docs_src/security/tutorial007_py39.py

@ -23,7 +23,7 @@ def get_current_username(credentials: HTTPBasicCredentials = Depends(security)):
raise HTTPException( raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED, status_code=status.HTTP_401_UNAUTHORIZED,
detail="Incorrect username or password", detail="Incorrect username or password",
headers={"WWW-Authenticate": "Basic"}, headers=security.make_authenticate_headers(),
) )
return credentials.username return credentials.username

Loading…
Cancel
Save