Skip to content

Commit 1bc2ee4

Browse files
authored
fix: strip padding from access tokens if present (#138)
Strips trailing `.` characters from access tokens fixes #137
1 parent 7e80713 commit 1bc2ee4

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

google/cloud/sql/connector/refresh_utils.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,8 +150,11 @@ 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+
153156
headers = {
154-
"Authorization": f"Bearer {credentials.token}",
157+
"Authorization": f"Bearer {credentials.token.rstrip('.')}",
155158
}
156159

157160
url = "https://www.googleapis.com/sql/{}/projects/{}/instances/{}/createEphemeral".format(

0 commit comments

Comments
 (0)