Skip to content

Commit 9f978a3

Browse files
committed
RFC variant selector added
1 parent 8cf94a7 commit 9f978a3

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

docs/advanced/authentication.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Bearer Token authentication ([RFC 6750](https://datatracker.ietf.org/doc/html/rf
3232
There are three variants to transmit the Token:
3333

3434
* `Authorization` Request Header Field
35-
* Form-Encoded Body Parameter
36-
* URI Query Parameter
35+
* Form-Encoded Body Parameter (not implemented)
36+
* URI Query Parameter (not implemented)
3737

3838
Since it is unencrypted it should typically only be used over `https`, although this is not strictly enforced.
3939

httpx/_auth.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ class BearerTokenAuth(Auth):
148148
and uses HTTP Bearer authentication (RFC 6750).
149149
"""
150150

151-
def __init__(self, bearer_token: str | bytes) -> None:
151+
def __init__(self, bearer_token: str | bytes, variant: typing.Literal["HEADER", "FORM-ENCODED", "QUERY"] = "HEADER") -> None:
152+
if variant != "HEADER":
153+
raise NotImplementedError(f"BearerTokenAuth variant '{variant}' is not yet implemented")
152154
self._auth_header = self._build_auth_header(bearer_token)
153155

154156
def auth_flow(self, request: Request) -> typing.Generator[Request, Response, None]:

0 commit comments

Comments
 (0)