[GH-ISSUE #3880] Login API returns identical response for wrong credentials and missing 2FA code #2625

Closed
opened 2026-10-31 20:26:47 +07:00 by bsakaguchi · 0 comments
Owner

Originally created by @hexlouw on GitHub (Mar 3, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/3880

When twoFactorCode is not provided but credentials are correct, the server returns the same response as for wrong credentials:

{ "success": false, "msg": "Invalid username or password or two-factor code." }

This makes it impossible for third-party clients to implement an adaptive login flow — showing the 2FA field only when actually needed.

Describe the solution you'd like

Suggested fix

Return distinct messages based on the actual failure reason:

{ "success": false, "msg": "wrong username or password" }  // bad credentials
{ "success": false, "msg": "2FA code required" }           // credentials ok, code missing
{ "success": false, "msg": "invalid 2FA code" }            // credentials ok, code wrong

Describe alternatives you've considered

No response

Checklist

  • This feature report is written entirely in English.
Originally created by @hexlouw on GitHub (Mar 3, 2026). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/3880 ### Is your feature request related to a problem? When `twoFactorCode` is not provided but credentials are correct, the server returns the same response as for wrong credentials: ```json { "success": false, "msg": "Invalid username or password or two-factor code." } ``` This makes it impossible for third-party clients to implement an adaptive login flow — showing the 2FA field only when actually needed. ### Describe the solution you'd like ### Suggested fix Return distinct messages based on the actual failure reason: ```json { "success": false, "msg": "wrong username or password" } // bad credentials { "success": false, "msg": "2FA code required" } // credentials ok, code missing { "success": false, "msg": "invalid 2FA code" } // credentials ok, code wrong ``` ### Describe alternatives you've considered _No response_ ### Checklist - [x] This feature report is written entirely in English.
bsakaguchi 2026-10-31 20:26:47 +07:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#2625
No description provided.