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 .netrc support when using --auth-type bearer #1569

Open
1 task done
pwagland opened this issue Mar 5, 2024 · 0 comments
Open
1 task done

Add .netrc support when using --auth-type bearer #1569

pwagland opened this issue Mar 5, 2024 · 0 comments
Labels
enhancement New feature or enhancement new Needs triage. Comments are welcome!

Comments

@pwagland
Copy link

pwagland commented Mar 5, 2024

Checklist

  • I've searched for similar feature requests. The closest I found is where this was implemented in xh

Enhancement request

When using https, I don't want to have to hard-code my token in all scripts, rather I would like to have a central location where the token can be read from. This already works for the basic authentication type, but not, as far as I can tell, for the bearer auth type.

If this is implemented, then this enhancement request is to document it clearly, what needs to be in the file as https://httpie.io/docs/cli/netrc does not seem to cover it.


Problem it solves

I'm always frustrated when writing a script that I need to hard code the token in it, as it makes the script harder to share.


Additional information, screenshots, or code examples

This is implemented in xh and with the following in the .netrc:

machine host.local.lan password SecretToken

then

xh --json --auth-type bearer "https://host.local.lan/rest/api/latest/…"

Correctly sends the header:

Authorization: Bearer SecretToken

It would be great if httpie would support this same functionality.

@pwagland pwagland added enhancement New feature or enhancement new Needs triage. Comments are welcome! labels Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or enhancement new Needs triage. Comments are welcome!
Projects
None yet
Development

No branches or pull requests

1 participant