title: Verified user with Firebase
body: <p>I want to create a login where the user only has to put his/her mail address and verify it via email. Using firebase I have this code so far:</p>
  
  <ul>
  <li><p>When the user clicks the button to login after putting the mail in the field. I try to create a new account (password is random as I don't need it). If it doesn't exists I send a verification mail. If the account exists I check with <strong>checkIfVerifiedUser</strong> if the user verified the account by clicking the mail or not.</p>
  
  <pre><code>firebaseAuth.createUserWithEmailAndPassword(email, Math.random() + "").addOnCompleteListener(new OnCompleteListener&lt;AuthResult&gt;() {
  @Override
  public void onComplete(@NonNull Task&lt;AuthResult&gt; task) {
      if (task.isSuccessful()) {
          FirebaseUser user = firebaseAuth.getCurrentUser();
          user.sendEmailVerification().addOnCompleteListener((Activity) context, new OnCompleteListener() {
                      @Override
                      public void onComplete(@NonNull Task task) {
                          if (task.isSuccessful()) {
                              Toast.makeText(context, "we sent a mail, please verify", Toast.LENGTH_LONG).show();
                          } else {
                              Toast.makeText(context, "error", Toast.LENGTH_LONG).show();
                          }
                      }
                  }); 
          checkIfVerifiedUser(email);
      } else {
          progressDialog.dismiss();
          try {
              throw task.getException();
          } catch (FirebaseAuthUserCollisionException e) {
        // In case the account already exists
              checkIfVerifiedUser(email);
          } catch (Exception e) {
              Toast.makeText(context, R.string.error_auth, Toast.LENGTH_SHORT).show();
          }
      }
  }    });
  </code></pre></li>
  </ul>
  
  <p>Here is the method I call:</p>
  
  <pre><code>private void checkIfVerifiedUser(String email){
          final FirebaseUser user = firebaseAuth.getCurrentUser();
          Intent intent = new Intent(context, HomeActivity.class);
          if(user != null){
              user.reload();
              // If the user is created, we check if the account is verified
              if(user.isEmailVerified()) {
                  intent.putExtra(IntentEnum.ALREADYREGISTERED.getCode(), true);
              }else{
                  intent.putExtra(IntentEnum.ALREADYREGISTERED.getCode(), false);
              }
          }else{
              intent.putExtra(IntentEnum.ALREADYREGISTERED.getCode(), false);
          }
          ---rest of code---
      }
  </code></pre>
  
  <p>The problem is that I either get firebaseAuth.getCurrentUser() == null or user.isEmailVerified() always false (even if I click the link in the email I get sent). </p>
  
  <p>Could anyone help me with this? 
  Thanks!</p>