Skip to content

Commit

Permalink
rest: Set OAuth Content-Type header explicitly (apache#478)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko authored and hpal committed Mar 1, 2024
1 parent 5a7f662 commit 6bd70c0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pyiceberg/catalog/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,10 @@ def _fetch_access_token(self, session: Session, credential: str) -> str:
# take scope from properties or use default CATALOG_SCOPE
scope = self.properties.get("scope") or CATALOG_SCOPE

data = {GRANT_TYPE: CLIENT_CREDENTIALS, CLIENT_ID: client_id, CLIENT_SECRET: client_secret, SCOPE: scope}
# Uses application/x-www-form-urlencoded by default
response = session.post(url=self.auth_url, data=data)
data = {GRANT_TYPE: CLIENT_CREDENTIALS, CLIENT_ID: client_id, CLIENT_SECRET: client_secret, SCOPE: CATALOG_SCOPE}
response = session.post(
url=self.auth_url, data=data, headers={**session.headers, "Content-type": "application/x-www-form-urlencoded"}
)
try:
response.raise_for_status()
except HTTPError as exc:
Expand Down

0 comments on commit 6bd70c0

Please sign in to comment.