request.auth.uid中将包含什么?

时间:2019-01-14 02:25:01

标签: android firebase firebase-authentication firebase-security-rules

我正在遵循以下链接中的答案,以使用“ request.auth.uid”为用户过滤记录。 Issue in authentication in firebase cloud firestore at user level

service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read: if request.auth.uid != null && resource.data.createdBy ==     request.auth.uid;
      allow write: .... 
    }
  }
}

问题

  1. request.auth.uid中将包含什么?
  2. 如何将值传递给位于firebase中的request.auth.uid

3 个答案:

答案 0 :(得分:1)

  1. request.auth.uid将包含已通过Firebase身份验证进行身份验证的用户的UID。
  2. 您不传递值-使用Firebase身份验证时,它们直接来自客户端。必须先登录用户,然后Firestore SDK才会传递信息。

答案 1 :(得分:1)

  • request.auth.uid代表Firebase用户的用户ID。

  • 只要用户登录,Firestore就会自动发送值,您无需手动进行操作。

答案 2 :(得分:0)

例如:{"uid": "iMuWxlrQYbQUoiAsH9N6bCPe37Hi", ..}

相关问题