Authentication

The Authentication header is composed of a base plugin, and two derived plugins.

Authentication

The authentication plugin adds a method to add a self-generated token to the “authorization” header:

http = HTTPX.plugin(:authentication)
http.authentication("AUTH-TOKEN").get("https://api.myapp.com/resources")

Basic Authentication

The basic authentication plugin can create an HTTP Basic Auth compatible header based on a username and password.

http = HTTPX.plugin(:basic_authentication)
http.basic_authentication("user", "pass").get("https://api.myapp.com/resources")

Digest Authentication

The digest authentication plugin can create an HTTP Digest Auth compatible header based on a username and password.

http = HTTPX.plugin(:digest_authentication)
http.digest_authentication("user", "pass").get("https://api.myapp.com/resources")

Caveats

Due to the nature of how HTTP Digest Auth works, the concurrency of multiple requests is limited to one-at-a-time.

Next: Follow Redirects