How do I lock down Firebase Database to any user from a specific (email) domain?

后端 未结 6 2000
灰色年华
灰色年华 2020-11-22 08:36

I have a small, personal Firebase webapp that uses Firebase Database. I want to secure (lock down) this app to any user from a single, specific domain. I want to authenticat

6条回答
  •  醉梦人生
    2020-11-22 09:11

    Here is code working fine with my database , I have set rule that only my company emails can read and write data of my firebase database .

    {
      "rules": {
        ".read": "auth.token.email.matches(/.*@yourcompany.com$/)",
    
    
            ".write": "auth.token.email.matches(/.*@yourcompany.com$/)"
          }
        }
    

提交回复
热议问题