如何在python中获取firebase当前用户id(uid)?

如何在python中获取firebase当前用户id(uid)?,python,firebase,Python,Firebase,我需要获取当前用户id。 在Javascript中,我使用它来获取id uid = firebase.auth().currentUser.uid // uid= ABO0Xc2E6KSDodEhenICkXF371x1 如何在python中获取uid ?您没有提到库,但您所有的其他问题都使用Pyrebase,因此请浏览文档(您肯定应该阅读这些文档) user=auth.使用电子邮件和密码(电子邮件,密码)登录 打印(用户['localId']) 这将在输出屏幕上显示当前的firebase

我需要获取当前用户id。
在Javascript中,我使用它来获取id

uid = firebase.auth().currentUser.uid // uid= ABO0Xc2E6KSDodEhenICkXF371x1 
如何在python中获取uid

您没有提到库,但您所有的其他问题都使用Pyrebase,因此请浏览文档(您肯定应该阅读这些文档)


user=auth.使用电子邮件和密码(电子邮件,密码)登录 打印(用户['localId'])


这将在输出屏幕上显示当前的firebase UID

重新提出一个旧问题,但查看Pyrebase的文档时,我注意到当您刷新令牌时,用户ID(与其他身份验证函数相比)被重新引用。因此,我的解决方案是:

user = auth.sign_in_with_email_and_password("email", "pass")
user = auth.refresh(user['refreshToken'])    
print(user['userId'])
编辑:


我现在看到,即使在刷新之前,用户对象中也有一个“localId”变量-如图所示。

这是无需登录或注册即可检索用户id的代码

auth.current_user['localId']
auth.current_user['localId']