Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: harden lookup of credentials id_token attribute #434

Merged
merged 1 commit into from Aug 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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