Navigation Menu

Skip to content

Commit

Permalink
fix: harden lookup of credentials id_token attribute (#434)
Browse files Browse the repository at this point in the history
  • Loading branch information
crwilcox committed Aug 26, 2021
1 parent 5950e2b commit e28272a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion google/cloud/firestore_v1/base_client.py
Expand Up @@ -180,7 +180,10 @@ def _emulator_channel(self, transport):
# https://github.com/googleapis/python-firestore/issues/359
# Default the token to a non-empty string, in this case "owner".
token = "owner"
if self._credentials is not None and self._credentials.id_token is not None:
if (
self._credentials is not None
and getattr(self._credentials, "id_token", None) is not None
):
token = self._credentials.id_token
options = [("Authorization", f"Bearer {token}")]

Expand Down

0 comments on commit e28272a

Please sign in to comment.