Skip to content

Commit

Permalink
Update _credentials_base.py
Browse files Browse the repository at this point in the history
  • Loading branch information
rinarakaki committed Oct 16, 2024
1 parent 0c6abb0 commit 9da2c78
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions google/auth/_credentials_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,14 @@ def _apply(self, headers: dict[str, str], token: Optional[str] = None):
"""Apply the token to the authentication header.
Args:
headers (Mapping): The HTTP request headers.
headers (dict[str, str]): The HTTP request headers.
token (Optional[str]): If specified, overrides the current access
token.
"""
headers["authorization"] = "Bearer {}".format(
_helpers.from_bytes(token or self.token)
)
if token is not None:
value = token
elif self.token is not None:
value = self.token
else:
assert False, "token must be set"
headers["authorization"] = "Bearer {}".format(_helpers.from_bytes(value))

0 comments on commit 9da2c78

Please sign in to comment.