Skip to content

Commit 099ebf3

Browse files
authored
chore: move rstrip() to where proxy extracts token (#141)
updates patch for #137
1 parent 66e4e2e commit 099ebf3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

google/cloud/sql/connector/refresh_utils.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,8 @@ async def _get_ephemeral(
150150
request = google.auth.transport.requests.Request()
151151
credentials.refresh(request)
152152

153-
# TODO: remove this once issue with OAuth2 Tokens is resolved.
154-
# See https://github.com/GoogleCloudPlatform/cloud-sql-python-connector/issues/137
155-
156153
headers = {
157-
"Authorization": f"Bearer {credentials.token.rstrip('.')}",
154+
"Authorization": f"Bearer {credentials.token}",
158155
}
159156

160157
url = "https://www.googleapis.com/sql/{}/projects/{}/instances/{}/createEphemeral".format(
@@ -164,7 +161,9 @@ async def _get_ephemeral(
164161
data = {"public_key": pub_key}
165162

166163
if enable_iam_auth:
167-
data["access_token"] = credentials.token
164+
# TODO: remove this once issue with OAuth2 Tokens is resolved.
165+
# See https://github.com/GoogleCloudPlatform/cloud-sql-python-connector/issues/137
166+
data["access_token"] = credentials.token.rstrip('.')
168167

169168
resp = await client_session.post(
170169
url, headers=headers, json=data, raise_for_status=True

0 commit comments

Comments
 (0)