2014-02-13 45 views
0

找不到火力AUTH安全規則的用戶名失蹤

https://www.firebase.com/docs/security/rule-expressions/auth.htmlhttps://www.firebase.com/docs/security/simple-login-email-password.html

而且在安全頁面,我看到:

https://www.firebase.com/docs/security/security-rules.html

"rules": { 
    ".read": "auth.username == 'admin'", 
    ".write": "auth.username == 'admin'" 
    } 

而且我想在我的一個安全規則中使用用戶名:

"something" 
    "$name": { 
     ".write": "$name == auth.name" 
     } 

默認情況下,auth.username是否可用?如果不是,我如何才能在Firebase安全中訪問它。

BTW:(我有一個字段「名」在我的用戶「表」)

+0

[Firebase工程師]您在這裏使用哪種簡單的登錄驗證方法? 「用戶名」屬性僅適用於某些驗證方法。 –

+0

您好,先生,我使用簡單的密碼登錄。我做了一個解決方法,保存$ id而不是$ username,但我仍然對答案很好奇:) – EnchanterIO

回答

1

對於火力地堡簡單登錄電子郵件/密碼驗證方法,在安全規則的auth對象上定義的唯一屬性標題爲標題下的https://www.firebase.com/docs/security/simple-login-email-password.html

這包括以下:

  • 提供商 - 所使用的認證方法,在這種情況下:password)。
  • 電子郵件 - 用戶的電子郵件地址(字符串)。
  • id - 用戶的Firebase自動遞增ID(字符串)。
  • uid - 一個結合提供者和ID的唯一ID,用作用戶數據的唯一密鑰(字符串)。
+0

超級,謝謝! – EnchanterIO