mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[GH-ISSUE #5591] [Bug]: 🚨 API Keys Not Working in v3.4.1 #3908
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#3908
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @skyboy610 on GitHub (Jun 26, 2026).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/5591
Describe the bug
Since updating to v3.4.1, the API keys are not working, and I can no longer connect to the panel via the API. Could you please look into this issue? My work has been blocked since yesterday.
Thank you.
How to reproduce the problem
Expected behavior
The API key should authenticate successfully and allow access to the panel.
Actual behavior
The API key is rejected, and I cannot connect to the panel via the API.
Relevant logs
Screenshots
This issue started immediately after updating to v3.4.1. My work has been blocked since yesterday because of this problem.
3x-ui version
3.4.1
Xray-core version
No response
How did you install 3x-ui?
install.sh script
Operating system
ubuntu 24.04
Which parts of the panel are affected?
No response
Browser (only if it is a UI bug)
No response
Is the panel behind a reverse proxy or CDN?
None
Before submitting
@github-actions[bot] commented on GitHub (Jun 26, 2026):
The report does not include enough detail to confirm a bug, but some background on how API token authentication works may help resolve this immediately.
How authentication works in the current code
Tokens are stored as SHA-256 hashes; the plaintext is returned exactly once when the token is created and is never retrievable again (confirmed in
internal/web/service/panel/api_token.goand the UI string ininternal/web/translation/en-US.json: "Copy this token now. For security it is not stored in readable form and will not be shown again.").Authentication requires the original plaintext value in an
Authorizationheader:The check is in
internal/web/controller/api.go(checkAPIAuth): the panel hashes what is presented and compares it to the stored hash. If the stored token is a valid hash and the correct plaintext is presented, it matches. If the presented string is wrong (e.g., a hash digest instead of the original plaintext, or the wrong token value), it will not match.What changed in v3.4.1
The v3.4.1 changelog contains no changes to API token storage, the
checkAPIAuthmiddleware, or theMatchfunction. The token-hashing migration was introduced in v3.2.7 (fix(api-token): hash tokens at rest and show plaintext only once), and a database seeder (hashExistingApiTokens, ininternal/database/db.go) runs on startup to hash any plaintext tokens that pre-date that release. Nothing in v3.4.1 touches this path.Most likely causes
Authorization: Bearer <token>(e.g., as a query parameter, in a different header, or with aTokenprefix instead ofBearer).To confirm and resolve
200response means authentication is working. A401or404means the token or header format is wrong.Information needed to investigate further
If the above does not resolve the issue, please provide:
401,404, or other).This reply was generated automatically; a maintainer may follow up.
@MHSanaei commented on GitHub (Jun 26, 2026):
Everything works
@hellousersxx commented on GitHub (Jun 27, 2026):
If you fixed the problem, how did you do it? Let me know if you got it fixed.