【发布时间】:2019-07-23 15:43:06
【问题描述】:
我正在使用带有 firestore 的 python,并尝试在后端创建一个客户端。我正在关注this 教程
使用以下代码
import firebase_admin
from firebase_admin import credentials, firestore
cred = credentials.Certificate("cred_file.json")
firebase_admin.initialize_app(cred)
db = firestore.Client()
ref = db.collections(u'table')
并得到以下错误
google.auth.exceptions.DefaultCredentialsError:不能 自动确定凭据。请设置 GOOGLE_APPLICATION_CREDENTIALS 或显式创建凭据和 重新运行应用程序。欲了解更多信息
我猜这是默认凭据有问题,我没有得到的是,如果我在我的代码中初始化凭据,为什么应用程序会不断为默认凭据抛出错误?我明确地给了它正确的信用文件。
【问题讨论】:
-
你能发布一个堆栈跟踪吗?
标签: python firebase google-cloud-firestore firebase-admin