FastAPI Authentication & Authorization

Assess your knowledge of OAuth2,JWTs,and security in APIs.

1. Which OAuth2 flow is commonly used for username/password authentication in FastAPI?
2. What dependency is used to retrieve the OAuth2 token from the request in FastAPI?
3. Which is the recommended approach for storing passwords in FastAPI applications?
4. What HTTP status code is returned by FastAPI when authentication credentials are missing?
5. Which Pydantic model is used to handle username/password input for OAuth2 login in FastAPI?
6. What is the primary purpose of OAuth2 scopes in FastAPI?
7. Select all valid password hashing libraries compatible with FastAPI for secure password storage.
8. Which components are part of a JSON Web Token (JWT)?
9. Which of these can be used to implement authentication in FastAPI?
10. What are common use cases for FastAPI dependencies in authentication/authorization?
11. FastAPI requires the use of JWT (JSON Web Tokens) for implementing authentication.
12. The OAuth2PasswordBearer dependency automatically validates the token's signature and expiration.
13. In FastAPI, you can raise an HTTPException with status code 403 to deny access to unauthorized users.
14. What does JWT stand for? (full name)
15. Name the FastAPI dependency that extracts the API key from the request headers (common class name).
Answered 0 of 0 — 0 correct