# The Signed-In User

The Signed-In User: Requiring a Signed-In User, Roles and Ownership: 401 or 403.

Updated: November 19, 2026

1. [Requiring a Signed-In User](https://www.ask-codey.com/lessons/fastapi-auth-current-user-dependency) (Journeyman): A get_current_user dependency reads the token from the Authorization header with OAuth2PasswordBearer, decodes it with PyJWT and loads the user from the database, so a route that asks for it serves only signed-in users and answers everyone else 401 with a WWW-Authenticate header.
2. [Roles and Ownership: 401 or 403](https://www.ask-codey.com/lessons/fastapi-auth-roles-and-ownership) (Journeyman): Signed in isn't the same as allowed, so a require_role dependency lets only the right role through, an ownership check compares a record's owner with the signed-in user's id, and both answer 403 Forbidden, while 401 stays for a request with no valid token.

Source: https://www.ask-codey.com/courses/python-web-apis/topics/fastapi-the-signed-in-user
