Skip to content

Commit

Permalink
pass str(org_id) to cloud auth api
Browse files Browse the repository at this point in the history
  • Loading branch information
joeyorlando committed Jan 26, 2024
1 parent 19686a9 commit c5917f4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
9 changes: 5 additions & 4 deletions engine/common/cloud_auth_api/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,20 +45,21 @@ def __init__(self):
def request_signed_token(
self, org: "Organization", scopes: typing.List[Scopes], claims: typing.Dict[str, typing.Any]
) -> str:
org_id = org.org_id
stack_id = org.stack_id
# The Cloud Auth API expects the org_id and stack_id to be strings
org_id = str(org.org_id)
stack_id = str(org.stack_id)

# NOTE: header values must always be strings
headers = {
"Authorization": f"Bearer {self.api_token}",
# need to cast to str otherwise - requests.exceptions.InvalidHeader: Header part ... from ('X-Org-ID', 5000)
# must be of type str or bytes, not <class 'int'>
"X-Org-ID": str(org_id),
"X-Org-ID": org_id,
"X-Realms": json.dumps(
[
{
"type": "stack",
"identifier": str(stack_id),
"identifier": stack_id,
},
]
),
Expand Down
2 changes: 1 addition & 1 deletion engine/common/cloud_auth_api/tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def _make_request():
"claims": claims,
"extra": {
"scopes": scopes,
"org_id": org_id,
"org_id": str(org_id),
},
},
)

0 comments on commit c5917f4

Please sign in to comment.