Skip to content

馃悰 Fix return 401 instead of 404 when a token's user doesn't exist - #2474

Open
ErikH-move wants to merge 1 commit into
fastapi:masterfrom
ErikH-move:fix/user-not-found-401
Open

馃悰 Fix return 401 instead of 404 when a token's user doesn't exist#2474
ErikH-move wants to merge 1 commit into
fastapi:masterfrom
ErikH-move:fix/user-not-found-401

Conversation

@ErikH-move

Copy link
Copy Markdown

get_current_user returned 404 when the user id it encoded no longer existed. 404 is the wrong code since nothing about the requested resource is missing, the presented credential is just invalid. An issue with the 404 code was that the frontend's global error handler only clears and redirects to login on 401/403.

get_current_user returned 404 when the user id it encoded no longer existed.
404 is the wrong code since nothing about the requested resource is missing, the presented credential is just invalid.
An issue with the 404 code was that the frontend's global error handler only clears and redirects to login on 401/403.
@YuriiMotov YuriiMotov changed the title Fix return 401 instead of 404 when a token's user no longer exists 馃悰 Fix return 401 instead of 404 when a token's user doesn't exist Sep 3, 2026
@YuriiMotov YuriiMotov added the bug Something isn't working label Sep 3, 2026
@YuriiMotov

Copy link
Copy Markdown
Member

I agree 401 is correct status code here.

@ErikH-move, could you please add a test?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working waiting

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants