Search code examples

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>


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 ( for this
  // URL must be whitelisted in the Firebase Console.
  // url: `${window.location.protocol}//${}/`,
  url: http://localhost:7000/#postLogin,
  // This must be true.
  handleCodeInApp: true

firebase.auth().sendSignInLinkToEmail(, 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.
        .catch(error => {
          // Some error occurred, you can inspect the code: error.code


  • I am not sure how you managed to get this url. Either you removed apiKey from your url to attach screenshot on SO or you have misconfigured something due to which apiKey is not included in the email verification link.

    To test my hypothesis, I created new firebase app and deployed it to which just has a send email link button, which sends email to myself and email link works if I click on verification link received in email. It only doesn't work if I remove apiKey from the link in the email.

    enter image description here

    Your email link should be:{yourApiKey}&oobCode={obbCode}&continueUrl={urlParameter}&lang=en