fix: strip "token " prefix in multi-user mode#4
Open
zfsone wants to merge 1 commit intoraohwork:masterfrom
Open
fix: strip "token " prefix in multi-user mode#4zfsone wants to merge 1 commit intoraohwork:masterfrom
zfsone wants to merge 1 commit intoraohwork:masterfrom
Conversation
In multi-user mode, the server extracts the token from the client's Authorization header. It correctly strips the "Bearer " prefix, but does not strip the "token " prefix that Forgejo's own API documentation recommends (Authorization: token <value>). This causes the token to be passed as "token abc123" to NewClient, which then sets the header to "Authorization: token token abc123", resulting in silent authentication failure. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
--tokenflag), the server reads theAuthorizationheader from each client requestBearerprefix is correctly stripped, but thetokenprefix (which is what Forgejo's API docs recommend:Authorization: token <value>) is nottoken abc123to be passed toNewClient, which then setsAuthorization: token token abc123— double prefix, silent auth failuretokenprefix stripping alongside the existingBearerhandlingTest plan
forgejo-mcp http --server <url> --address :8080)Authorization: token <valid-token>headerlist_my_repositories)Authorization: Bearer <token>still works🤖 Generated with Claude Code