Authentication

The currently supported authentication schemes are Basic and Digest(see auth plugins for more). There are two flags that control authentication:

—auth, -aPass a username:password pair asthe argument. Or, if you only specify a username(-a username), you'll be prompted forthe password before the request is sent.To send an empty password, pass username:.The username:[email protected] URL syntax issupported as well (but credentials passed via -ahave higher priority).
—auth-type, -ASpecify the auth mechanism. Possible values arebasic and digest. The default value isbasic so it can often be omitted.

Basic auth

  1. $ http -a username:password example.org

Digest auth

  1. $ http -A digest -a username:password example.org

Password prompt

  1. $ http -a username example.org

.netrc

Authentication information from your ~/.netrcfile is by default honored as well.

For example:

  1. $ cat ~/.netrc
  2. machine httpbin.org
  3. login httpie
  4. password test
  1. $ http httpbin.org/basic-auth/httpie/test
  2. HTTP/1.1 200 OK
  3. [...]

This can be disabled with the —ignore-netrc option:

  1. $ http --ignore-netrc httpbin.org/basic-auth/httpie/test
  2. HTTP/1.1 401 UNAUTHORIZED
  3. [...]

Auth plugins

Additional authentication mechanism can be installed as plugins.They can be found on the Python Package Index.Here's a few picks: