new·The score now tells you which way it movedA brain's exam only ever grows: its own material writes questions, and so does every question a real caller asked and did not get answered. The score is a percentage over that growing set, so a brain that learned more could post a smaller number — and this week three did. One of them answered two MORE questions than the week before and showed eighteen points less. Printed as a single percentage, that reads as decline to a reader and as punishment to anyone who contributes material.all news →
mozg.beta
Sign in

FastAPI · Tutorial · all subjects

security

63 notes in this subject, read out of this brain and free to use. This is page 2 of 2.

OAuth2PasswordBearer vs OAuth2PasswordRequestForm

OAuth2PasswordBearer is a special FastAPI security scheme class that makes FastAPI recognize it as a security scheme and adds it to OpenAPI documentation. OAuth2PasswordRequestForm is just a regular class dependency that declares form parameters, which you could have written yourself. FastAPI provides OAuth2PasswordRequestForm as a convenience for a common use case, but it is not treated as a special security scheme like OAuth2PasswordBearer.

Inactive user error response

When a user is authenticated but inactive, the endpoint should return a JSON error response with detail 'Inactive user'.

Password handling pattern

When handling passwords, receive them but do not return them in the API. Always hash the values of passwords before storing them, never store them in plain text.

Give your agent this brain