skip to Main Content

In my flutter app I want to create a phone authentication for sign up, with one condition that only those phone numbers, which are already been stored in firestore database can sign up.. ….. How can I access firestore data before signing in?

2

Answers


  1. You can create a rule set for firebase access on the firebase application console.

    This is a good place to look:

    Firestore Security Rules Docs

    Login or Signup to reply.
  2. Register a blocking function for beforeCreate event and check that a user’s phoneNumber is in a list of allowed numbers. If not throw an error.

    Triggers before a new user is saved to the Firebase Authentication database, and before a token is returned to your client app.

    const functions = require('firebase-functions');
    
    exports.beforeCreate = functions.auth.user().beforeCreate((user, context) => {
      // TODO check user.phoneNumber againts allowed ones
    });
    

    See Extend Firebase Authentication with blocking Cloud Functions for details.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search