Skip to content

Commit 82a4b20

Browse files
committed
fix: use uppercase Bearer in Authorization headers
The Cloud PDP requires uppercase "Bearer" in the Authorization header per RFC 6750. Using lowercase "bearer" causes 401 Unauthorized errors. Fixes #122
1 parent 47e47df commit 82a4b20

4 files changed

Lines changed: 4 additions & 4 deletions

File tree

permit/api/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ def _build_http_client(self, endpoint_url: str = "", *, use_pdp: bool = False, *
174174
base_url=self.config.pdp if use_pdp else self.config.api_url,
175175
headers={
176176
"Content-Type": "application/json",
177-
"Authorization": f"bearer {self.config.token}",
177+
"Authorization": f"Bearer {self.config.token}",
178178
**optional_headers,
179179
},
180180
)

permit/enforcement/enforcer.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ def __init__(self, config: PermitConfig):
4444
self._context_store = ContextStore()
4545
self._headers = {
4646
"Content-Type": "application/json",
47-
"Authorization": f"bearer {self._config.token}",
47+
"Authorization": f"Bearer {self._config.token}",
4848
}
4949
self._base_url = self._config.pdp
5050

permit/pdp_api/base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def _build_http_client(self, endpoint_url: str = "", **kwargs):
4848
base_url=f"{self.config.pdp}",
4949
headers={
5050
"Content-Type": "application/json",
51-
"Authorization": f"bearer {self.config.token}",
51+
"Authorization": f"Bearer {self.config.token}",
5252
},
5353
)
5454
client_config_dict = client_config.dict()

permit/pdp_api/pdp_api_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ def __init__(self, config: PermitConfig):
1919
self._config = config
2020
self._headers = {
2121
"Content-Type": "application/json",
22-
"Authorization": f"bearer {self._config.token}",
22+
"Authorization": f"Bearer {self._config.token}",
2323
}
2424
self._base_url = self._config.pdp
2525

0 commit comments

Comments
 (0)