title: firebase admin SDK create user and send verification email
body: <p>How can I send a verification email after I create a user with firebase admin SDK?
  I am trying to combine <a href="https://firebase.google.com/docs/auth/admin/manage-users#create_a_user" rel="noreferrer"><code>createUser function</code></a> and <a href="https://firebase.google.com/docs/auth/web/manage-users#send_a_user_a_verification_email" rel="noreferrer"><code>sendEmailVerification function</code></a>
  could somebody indicate a hint or an answer? thanks</p>
  
  <h2>update:</h2>
  
  <p>the user creation is being done by an admin user who is already signed in in the app, so the admin user is just creating users on the dashboad. This is completely different from the registeration methods.</p>
  
  <h2>update 2:</h2>
  
  <p>I tried to follow <a href="https://stackoverflow.com/a/41886023/6931572">bojeil's answer</a>, I am still stuck with the step that user signs in with the custom token. It gets into conflict with my current admin user session, the admin users gets kicked out and instead the new user is signed in and even when I sign out the new user, the admin user is still out and needs to sign in to get back into the app.</p>
  
  <p>here is my code inside the app after I get the custom token:</p>
  
  <pre><code>$http.post('/.custom-token', {uid: $scope.data.data.uid})
          .then(function (response) {
              console.log("custom token here:", response.data.token);
              firebase.auth().signInWithCustomToken(response.data.token)
                  .then(function (firebaseUser) {
                      firebaseUser.sendEmailVerification();
                      firebase.auth().signOut().then(function() {
                          // Sign-out successful.
                          console.log("signed out success");
                      }, function(error) {
                          // An error happened.
                      });
                  })
  
                  .catch(function(error) {
                      // Handle Errors here.
                      var errorCode = error.code;
                      var errorMessage = error.message;
                      // ...
                  });
  
          });
  </code></pre>
  
  <p>so, I get the token, sign in the new user, send the email verification link, and then, sign out the new user.
  But my admin user who is doing all of this gets signed out as well. 
  what am I missing here?</p>