Django 获取 firebase 用户 UID

Django fetch firebase User UID

我正在使用 Pyrebase to fetch data from firebase in Django and so far it seems to be able to do everything but for some reason, I can't fetch the User UID from the authentication page in firebase. 这对我来说是必要的,因为我的所有用户数据库节点都保存在此处的用户 UID 下。这是我目前的尝试,但 idToken 没有 return 用户 UID

  token = user['idToken']

  print(token)

我明白了。通过身份验证后,您可以调用 localId 来获取用户 UID。

user = auth.sign_in_with_email_and_password(email, password)

session_id = user['idToken'
request.session['uid'] = str(session_id)

print(user["localId"])