0
votes

I am trying to configure my firebase settings to that I can send the verifyEmail email from either my development or production environment.

I have a .env file with two settings in it as follows:

REACT_APP_PROD_CONFIRMATION_EMAIL_REDIRECT=https://example.com

REACT_APP_DEV_CONFIRMATION_EMAIL_REDIRECT=http://localhost:3000

Then in my firebase config file I have:

doSendEmailVerification = () =>
      this.auth.currentUser.sendEmailVerification({

      url: process.env.NODE_ENV === 'production' ? process.env.REACT_APP_PROD_CONFIRMATION_EMAIL_REDIRECT : process.env.REACT_APP_DEV_CONFIRMATION_EMAIL_REDIRECT,
      }); 

This works fine when I'm testing in the development environment.

When I deploy the release and try to test it in production - the email does not send.

Both firebase accounts are configured the same way to send the email.

No error message is generated and the step in my submit handler just gets skipped.

My submit handler has:

this.props.firebase
    .doCreateUserWithEmailAndPassword(values.email, values.password)
    .then(authUser => {
    return this.props.firebase.user(authUser.user.uid).set(
        {
          name: values.name,
          email: values.email,
          createdAt: new Date()

        },
        { merge: true },
    );
    })
    .then(() => {
      return this.props.firebase.doSendEmailVerification();
      })
    .then(() => {
      this.setState({ ...initialValues });
      this.props.history.push(ROUTES.DASHBOARD);
1

1 Answers

0
votes

You have to whitelist your domains in the Authentication section of firebase for this to work. I've seen several posts on here that say the whitelisting step is no longer required - but for me, it is.