I follow the tutorial about Security on FastAPI web site
Ending by having the following endpoint:
@app.post("/token", response_model= Token)
async def login(form_data: OAuth2PasswordRequestForm = Depends()):
user = authenticate_user(fake_users_db, form_data.username, form_data.password)
if not user:
raise HTTPException(
status_code=status.HTTP_401_UNAUTHORIZED,
detail="Incorrect username or password",
headers={"WWW-Authenticate": "Bearer"},
)
access_token_expires = timedelta(minutes=ACCESS_TOKEN_EXPIRE_MINUTES)
access_token = create_access_token(
data={"sub": user.username}, expires_delta=access_token_expires
)
return {"access_token": access_token, "token_type": "bearer"}
Resulting in the following swagger:
My question:
Is there a simple way to mask the password field? So I do not see it in plain text?
Like we can do with authorize button.
question from:
https://stackoverflow.com/questions/65933711/fastapi-masking-field 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…