Is there a way to restrict registrations in firebase

前端 未结 3 1857
刺人心
刺人心 2020-12-02 16:11

Is there a way to restrict users from registering firebase email/password accounts so that new users can\'t sign up? I have a small app that only a few admins need to have a

3条回答
  •  猫巷女王i
    2020-12-02 16:50

    @RobDiMarco provided a great answer, but it has a flaw.

    The rule root.child('admins').hasChild(auth.uid) will pass, in case auth.uid will be an empty string.

    You can test this in Firebase Database Security Simulator, clearing out uid field ({ "provider": "anonymous", "uid": ""}).

    This rule root.child('admins').child(auth.uid).val() === true will not pass with an empty uid.

提交回复
热议问题