From e28272a1a4e8f7a681f4506142f4d4cd6fa0b993 Mon Sep 17 00:00:00 2001 From: Christopher Wilcox Date: Thu, 26 Aug 2021 15:13:12 -0700 Subject: [PATCH] fix: harden lookup of credentials id_token attribute (#434) --- google/cloud/firestore_v1/base_client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/google/cloud/firestore_v1/base_client.py b/google/cloud/firestore_v1/base_client.py index 17068a974..73dfc0359 100644 --- a/google/cloud/firestore_v1/base_client.py +++ b/google/cloud/firestore_v1/base_client.py @@ -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}")]