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

后端 未结 6 2006
灰色年华
灰色年华 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条回答
  •  萌比男神i
    2020-11-22 09:27

    For anyone really not wanting to have unverified accounts logging in. Maybe dirty, but very effective.

    This is my workaround (Angular app):

    this.userService.login(this.email.value, this.password.value).then(data => {
      if (data.user.emailVerified === true) {
        //user is allowed
      } else {
        //user not allowed, log them out immediatly
        this.userService.logout();
      }
    }).catch(error => console.log(error));
    

提交回复
热议问题