Skip to content
This repository has been archived by the owner on Mar 4, 2022. It is now read-only.

Custom Authorization Headers appended to request #4

Open
sytabaresa opened this issue Jan 16, 2019 · 1 comment
Open

Custom Authorization Headers appended to request #4

sytabaresa opened this issue Jan 16, 2019 · 1 comment

Comments

@sytabaresa
Copy link

sytabaresa commented Jan 16, 2019

Hello, I want to use the httpie oauth plugin with custom Authorization value appended to the auto-generated value; but when I execute the following:

$ http --auth-type=oauth1 --auth='client-key:client-secret' example.org 'Authorization: oauth_token="token" '

The custom value is ignored.
Why this happen?

Thanks for you support!

@hoylen
Copy link

hoylen commented Jul 6, 2019

When httpie or httpie-oauth adds its own "Authorization" header, it appears to simply ignore and removes all "Authorization" headers (regardless of what scheme they use). That is probably the wrong behaviour.

Fortunately, OAuth parameters can come from several parts of the request (see section 3.4.1.3.1 of RFC5849):

  • The OAuth Authorization header (the most common);
  • Query components of the URI; or
  • the body when the Content-Type is "application/x-www-form-urlencoded".

So you can achieve the same result by either using query parameters:

$ http  ... http://example.org?oauth_token=token

Or encoded into the body:

$ http ... --form http://example.org oauth_token=token

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants