Skip to content

Commit 40c2d30

Browse files
committed
docs: Add documentation for HTTP digest auth-int support
1 parent c2abbfe commit 40c2d30

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

docs/advanced/authentication.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,18 @@ HTTP digest authentication is a challenge-response authentication scheme. Unlike
4040
[<Response [401 UNAUTHORIZED]>]
4141
```
4242

43+
HTTPX also supports digest authentication using `auth-int` quality-of-protection, which provides message integrity protection. When `qop="auth-int"` is used, the authentication response includes a hash of the request body, protecting against tampering with the message content during transmission. This provides additional security over `qop="auth"` by ensuring that both the authentication credentials and the message body integrity are verified.
44+
45+
```pycon
46+
>>> auth = httpx.DigestAuth(username="olivia", password="secret")
47+
>>> client = httpx.Client(auth=auth)
48+
>>> response = client.get("https://httpbin.org/digest-auth/auth-int/olivia/secret")
49+
>>> response
50+
<Response [200 OK]>
51+
>>> response.history
52+
[<Response [401 UNAUTHORIZED]>]
53+
```
54+
4355
## NetRC authentication
4456

4557
HTTPX can be configured to use [a `.netrc` config file](https://everything.curl.dev/usingcurl/netrc) for authentication.
@@ -229,4 +241,4 @@ class MyCustomAuth(httpx.Auth):
229241

230242
async def async_auth_flow(self, request):
231243
raise RuntimeError("Cannot use a sync authentication class with httpx.AsyncClient")
232-
```
244+
```

0 commit comments

Comments
 (0)