Saturday 17 October 2020

Firebase email link authentication leads to a page that says "Error encountered" - "The selected page mode is invalid"

I am on localhost with Firebase auth (firebase v7.23.0). The email is sent okay. I click the sign in link from my email. I get this error page on my <PROJECT>.firebaseapp.com

!

My code is mostly below, but this all works. It's the Firebase page is giving an error. I am not sure what else I need to set up. localhost is on the allowed domains. The error is on the Firebase side so I cannot do much to debug or fix it.

const actionCodeSettings = {
  // URL you want to redirect back to. The domain (www.example.com) for this
  // URL must be whitelisted in the Firebase Console.
  // url: `${window.location.protocol}//${window.location.host}/`,
  url: http://localhost:7000/#postLogin,
  // This must be true.
  handleCodeInApp: true
};

firebase.auth().sendSignInLinkToEmail(this.email, actionCodeSettings)
        .then(() => {
          // The link was successfully sent. Inform the user.
          // Save the email locally so you don't need to ask the user for it again.
          window.localStorage.setItem('email', this.email);
        })
        .catch(error => {
          // Some error occurred, you can inspect the code: error.code
        });
    }


from Firebase email link authentication leads to a page that says "Error encountered" - "The selected page mode is invalid"

No comments:

Post a Comment