这些年来,我已经看到一些人面临类似的问题,但是我的案子并没有太多发现。
我有一个使用python3构建的后端。
firebase_admin
作为连接到Firebase Cloud Firestore的库。 Exception: 401 Request had invalid authentication credentials. Expected OAuth 2 access token, login cookie or other valid authentication credential. See https://developers.google.com/identity/sign-in/web/devconsole-project.
我在做什么错?
Python代码:
from firebase_admin import firestore, initialize_app
initialize_app()
db = firestore.client()
def get_info_from_firestore(name: str:
try:
data = db.collection(u'data').where(u'title', u'==', name).stream()
for rating in ratings:
return rating.to_dict()
return None
except Exception as e:
logging.warning(Exception: {e}')
return None
此文件是从使用Flask的python根目录导入的。
编辑:如果我在不做任何更改的情况下重新部署容器,那么最后一件可能会有所帮助。
答案 0 :(得分:0)
这可能是由于时间漂移而发生的:docker 中的时间与实时显着不同。重新启动后时间是同步的,但一段时间后它会漂移。谷歌不喜欢它。在此处https://github.com/microsoft/WSL/issues/4245和此处https://github.com/docker/for-win/issues/4526
查看有关此 WSL/容器问题的更多信息