Repository navigation
fix(auth): percent-encode OAuth 1.0a parameters per RFC 5849 - #115
Open
wadefletch wants to merge 1 commit into
Open
wadefletch wants to merge 1 commit into
wadefletch wants to merge 1 commit into
Conversation
encode() used url.QueryEscape, which writes a space as + instead of %20, so every OAuth 1.0a request whose query contained a space, such as a multi-word search, was signed over a different base string than X computes and failed with 401. X also rejects a signed request whose query carries a raw reserved character, such as the colon in query=from:XDevelopers, so send the query in the same encoding the signature covers. Amp-Thread-ID: https://ampcode.com/threads/T-7e242faa-c06f-4a65-a920-3fcacb7f8810 Co-authored-by: Wade Fletcher <wade@tractorbeam.ai>
|
|
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.
With
--auth oauth1, any request whose query contains a space fails with a bare 401, including every multi-wordxurl search.encode()usesurl.QueryEscape, which writes a space as+, but RFC 5849 §3.6 requires%20, so xurl signs a different base string than X computes.Separately, X rejects a signed request whose query carries a raw reserved character, such as
query=from:XDevelopersorstart_time=2026-11-20T00:00:00Z, even when the signature is correct. xurl now sends the query in the same encoding it signs.