7

So, I have enabled email/password in the dev console and everything is working fine. Except that I should be getting a confirmation email to the email I inputted, but I'm not getting it. I thought it does it automatically, but apparently it doesn't.


Method for signup:

public void signUp(View v) {
    String email = emailET.getText().toString();
    String password = passwordET.getText().toString();
    mAuth.createUserWithEmailAndPassword(email, password)
            .addOnCompleteListener(this, new OnCompleteListener<AuthResult>() {
                @Override
                public void onComplete(@NonNull Task<AuthResult> task) {
                    Log.d("AD", "createUserWithEmail: " + task.isSuccessful() + task.getException());
                    if (!task.isSuccessful()) {
                        createDialogSignUpError(
                                getApplicationContext().getResources().getString(R.string.signUpFailedET),
                                getApplicationContext().getResources().getString(R.string.signUpFailedEM),
                                getApplicationContext().getResources().getString(android.R.string.ok));
                        Toast.makeText(SignUp.this, task.getException().toString(), Toast.LENGTH_LONG).show();
                    } else if (task.isSuccessful()) {
                        Toast.makeText(SignUp.this, "Registration Successful.", Toast.LENGTH_SHORT).show();
                    }
                }
            });

}

It should be sending, but sadly it's not. I've read somewhere on SO that you need to add a method or something to send the email, and it's missing in the docs, but that wasn't Java.


Edit

According to here, it is only supported in iOS and web. Which is pretty surprising, since after all, android IS Google, and Google is Firebase. So is it possible even with creating a custom sent email?


Edit 2: To be more clear, does Android have an Email sender like C#. That would be the best solution if there isn't an API for this.

Ali Bdeir
  • 4,151
  • 10
  • 57
  • 117
  • I guess you are right, reading the [docs](https://firebase.google.com/docs/auth/custom-email-handler) this is only available in ios and swift. There is also some discussions [here](http://stackoverflow.com/questions/17723195/is-there-any-way-to-do-email-confirmation-for-firebase-user-creation-and-or-pass) if you want to look to some workarounds. – adolfosrs Jun 30 '16 at 22:49
  • No, this is not a duplicate, if you didn't read, I said that I've seen questions like that and mine is completely different. – Ali Bdeir Jul 01 '16 at 00:19
  • Have you read this one? http://stackoverflow.com/questions/17723195/is-there-any-way-to-do-email-confirmation-for-firebase-user-creation-and-or-pass – johni Jul 30 '16 at 15:03
  • Email address verification is currently an experimental feature on iOS and Web. – Sunday G Akinsete Aug 13 '16 at 13:19
  • @SundayGAkinsete which is exactly what I mentioned in my post... – Ali Bdeir Aug 13 '16 at 13:37

2 Answers2

2

Now according to the updated firebase documentation

Here is how to send a verification mail to the user that in your case is after creating the account and letting the user to log-in then send him/her a notification that he have to verify the account and then the next login is blocked until he/she didn't verify (I think this is better than making the user is forced to open his email first)

Send a user a verification email

You can send an address verification email to a user with the sendEmailVerification method. For example:

FirebaseUser user = FirebaseAuth.getInstance().getCurrentUser();

user.sendEmailVerification()
        .addOnCompleteListener(new OnCompleteListener<Void>() {
            @Override
            public void onComplete(@NonNull Task<Void> task) {
                if (task.isSuccessful()) {
                    Log.d(TAG, "Email sent.");
                }
            }
        });
Dasser Basyouni
  • 3,142
  • 5
  • 26
  • 50
1

You can now plug any Firebase gaps in email coverage by rolling your own email sender using Firebase Cloud Functions. There's an example here. Of course this means more work than just configuring like the built-in options but at least means we can do whatever we need to do. :)

ostergaard
  • 3,377
  • 2
  • 30
  • 40