title: How can we make a user sign up another user using Firebase/Firestore?
body: <p>I know it's possible to sign up a user with email and password with the following code:</p>
  <pre><code>FirebaseAuth.instance.createUserWithEmailAndPassword(
            email: email,
            password: password;)
  </code></pre>
  <p>That works fine. I can also add documents and collections in Firestore as such:</p>
  <pre><code>Future&lt;void&gt; getUserDoc() {
    // Initiate an auth instance
    final FirebaseAuth _auth = FirebaseAuth.instance;
    // Initiate a firebase firestore instance
    final FirebaseFirestore _firestore = FirebaseFirestore.instance;
    // Create a current user object
    User user = _auth.currentUser!;
    // Create a document reference based on the 'users'
    DocumentReference ref = _firestore.collection('users').doc(user.uid);
  
    // Return a collection that sets/updates the following data
    // based on the user.uid
    return ref.set({
      'UID': user.uid,
      'Email': user.email,
      'CreatedUserAt': user.metadata.creationTime,
      'LastSignInAt': user.metadata.lastSignInTime,
      'EmailVerified': user.emailVerified,
    });
  }
  </code></pre>
  <p>What I need is that the user that is signed in now - for example a business, can sign up their clients. Their clients will receive a link in their email to confirm and then they are signed up to the platform. However, the tricky part is that those clients should be added to the business that signed them up through the business account when they log in. I'm really stuck with this part of how this logic would work in Firestore.</p>