Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add oauth support #117

Closed
mfussenegger opened this issue Jan 2, 2013 · 9 comments
Closed

Add oauth support #117

mfussenegger opened this issue Jan 2, 2013 · 9 comments
Labels
enhancement New feature or enhancement planned Solution is being worked on

Comments

@mfussenegger
Copy link

Are there any concrete plans already?
There are already some hints that this might be added in the future. I would like to help out a bit.

There is a wrapper around curl that does this. Maybe some parts of the implementation could be taken from it: http://packages.python.org/curlish/

@t-8ch
Copy link

t-8ch commented Jan 2, 2013

As httpie is powered by requests you may want to have a look at https://github.com/requests/requests-oauthlib.
See also http://docs.python-requests.org/en/latest/user/authentication/

@seanrose
Copy link

seanrose commented Jan 3, 2013

Will this include both OAuth 1 and OAuth 2?

@jkbrzt
Copy link
Member

jkbrzt commented Jan 4, 2013

Ideally both. Do you know of a good overview of the most common ways oauth is used?

Perhaps the auth backends could be made pluggable, distributed in its own packages, and once installed they could be enabled via the config file.

Btw, there is an older fork that adds support for OAuth 1.0 2-legged. It's not directly usable, but it provides the intended UI for specifying the auth type, key, and secret:

http --auth-type=oauth1_2leg --auth=ConsumerKey:ConsumerSecret POST http://localhost:5000/protected?w=1

@mfussenegger
Copy link
Author

Actually I would like to focus on OAuth2 first as it is easier to implement.

Some example of different OAuth consumers can probably taken from the oauth.org repo:
https://github.com/gulopine/foauth.org/tree/master/services

I am not sure how we should handle the different providers. Either do it in a similar way as curlish (that is: provide configuration files. Spawn a http server for the callback and use the browser-web-flow to get the token. This will probably be required for OAuth1 anyway).

Or integrate the services directly in httpie.
E.g. have an API like

http --auth-type=oauth2 --oauth-service=github --get-token --scopes=["public_repos"] --client-id=... --client-secret=...

But having to patch and update httpie just to use another service provider doesn't seem too appealing.

@seanrose
Copy link

Since HTTPie is built on top of requests, it might make sense to build OAuth 2 support into requests, which doesn't currently exist. They have an extension for OAuth 1 currently here: https://github.com/requests/requests-oauthlib

@akhenakh
Copy link

I've updated my fork for OAuth 1.0a https://github.com/akhenakh/httpie, as the patch is really small using requests-oauthlib can we integrate in httpie ?

@jkbrzt
Copy link
Member

jkbrzt commented Sep 22, 2013

@akhenakh Support for OAuth 1.0.a 2-legged is now provided by the httpie-oauth plugin (requires HTTPie master).

The plugin is meant to provide also 3-legged OAuth flow and OAuth 2 support later on, but will require more work.

@akhenakh
Copy link

@jkbr thanks for the update, you should fix the home page for httpie-oauth it says "pip install httpie-auth" !

@jkbrzt
Copy link
Member

jkbrzt commented Sep 24, 2013

@akhenakh good catch, fixed!

@jkbrzt jkbrzt closed this as completed Sep 24, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement planned Solution is being worked on
Projects
None yet
Development

No branches or pull requests

5 participants