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 support for OAuth 2.0 authentication flows #284

Open
jirutka opened this issue Sep 26, 2022 · 4 comments
Open

Add support for OAuth 2.0 authentication flows #284

jirutka opened this issue Sep 26, 2022 · 4 comments

Comments

@jirutka
Copy link
Contributor

jirutka commented Sep 26, 2022

Can you please consider adding support for OAuth 2.0, at least the client_credentials grant?

Example:

xh --auth-type oauth2 --auth <client_id>:<client_secret> --oauth-grant client_credentials --oauth-token-url https://example.org/oauth/token GET example.org/api/v1/hello
@ducaale
Copy link
Owner

ducaale commented Sep 26, 2022

@jirutka Given that we don't support plugins yet, I think we could add auth types that people find useful. Do you know of any CLI tool that supports OAuth 2.0? I know there are a couple of OAuth HTTPie plugins, but they differ from your proposed implementation.

@jirutka
Copy link
Contributor Author

jirutka commented Sep 26, 2022

I don’t know about any, that’s basically the reason why I’d like to add it into xh.

@blyxxyz
Copy link
Collaborator

blyxxyz commented Sep 27, 2022

In general we try to be compatible with HTTPie.

Similar issue for HTTPie (currently empty): httpie/cli#1427

For reference, this OAuth 1.0 plugin exists (and is listed in the official docs): https://github.com/qcif/httpie-oauth1

While it's ugly I think we'd want to go for the same approach of cramming everything inside the --auth option. That doesn't bloat the options and makes it much easier to persist in session files.

A popular OAuth 2.0 crate exists: https://lib.rs/crates/yup-oauth2

@jirutka
Copy link
Contributor Author

jirutka commented Sep 27, 2022

While it's ugly I think we'd want to go for the same approach of cramming everything inside the --auth option.

It was just an example, I don’t insist on that choice of options at all. :)

A popular OAuth 2.0 crate exists: https://lib.rs/crates/yup-oauth2

This is not suitable, it provides just the ‘device’, ‘service account’ and ‘installed’ authorization flows, not client_credentials nor authorization_code.

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

No branches or pull requests

3 participants