The Authentication header is composed of a base plugin, and two derived plugins.
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")
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_auth("user", "pass").get("https://api.myapp.com/resources")
The digest authentication plugin provides an API to authenticate requests using HTTP Digest access authentication
http = HTTPX.plugin(:digest_authentication)
http.digest_auth("user", "pass").get("https://api.myapp.com/resources")
Note: due to the required extra-roundtrip, requests will be executed one at a time.
(available since v0.15.0
).
The ntlm authentication plugin can provides an API to authenticate requests using NTLM authentication
http = HTTPX.plugin(:ntlm_authentication)
http.ntlm_auth("user", "pass", "Domain" ).get("https://api.myapp.com/resources")
Next: Follow Redirects