0
votes

In the comments of the accepted answer it was noted I should set my firebase version to 4.3.1, not my last version 4.2.0

Hi this should be rather straightforward, I'm following the documentation at: firebase passing state in email actions as well as changing the default email-handler

I'm looking to redirect the user after he has verified his e-mail to a new url. The url is already in the Authenticated domains in firebase.

I also already have my actionCodeSettings:

var actionCodeSettings = {
    url: 'http://myurl.io/join',
    iOS: {
      bundleId: 'com.myurl.ios'
    },
    android: {
      packageName: 'com.myurl.android',
      installApp: false,
      minimumVersion: '12'
    },
    handleCodeInApp: false
  };

  function sendEmailVerification() {
    console.log('sendEmail Verification');
    firebase.auth().currentUser.sendEmailVerification(actionCodeSettings).then(function() {
    });
  }

If I understand correctly, I now need to implement getParameterByName which I found from another answer. My 2 questions are:

1) The default action URL is https://faros-fe2f5.firebaseapp.com/__/auth/action . Am I supposed to change this? It will change automatically based on my actionCodeSettings I guess

2) At line 113 we have the function of interest and it takes the parameters that are retrieved through getParameterByName. How is the continueUrl called at this point?

I find the documentation a bit vague on this subject. At this stage I want to redirect the user after e-mail verification is complete

1

1 Answers

4
votes

1) The default action URL is https://faros-fe2f5.firebaseapp.com/__/auth/action . Am I supposed to change this? It will change automatically based on my actionCodeSettings I guess

If you want to handle the verification link in your own page, you can change it to your own link but that can only be done in the Firebase Console -> Auth -> Email templates section

The continue URL ('http://myurl.io/join') is the final redirect link which would be embedded in the continueUrl query parameter of the link. You would typically after email verification is complete, show a continue button to go to that link. This can be passed from the client and must be a whitelisted domain.

2) At line 113 we have the function of interest and it takes the parameters that are retrieved through getParameterByName. How is the continueUrl called at this point?

You only need to write this if you are using your own email action URL and not the .../__/auth/action link above. You would after email verification is applied, show a continue button to go back to that link.

I recommend you try the flow with the default widget, click the link, verify the email and then click the continue button. You can mimic that and build your own custom landing page based on that.