title: Firebase facebook signInWithRedirect not redirecting to specified page on login success
body: <p>I am using Firebase's facebook signInWithRedirect but can't figure out why my application won't navigate to the specific page on redirect and instead it just returns back to the home page. I followed the steps on <a href="https://firebase.google.com/docs/auth/web/facebook-login" rel="nofollow noreferrer">https://firebase.google.com/docs/auth/web/facebook-login</a> and believe I have setup everything correctly. Below is my login code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$("#login").click(function() {
      firebase.auth().signInWithRedirect(provider);
      }
    });
  
  firebase.auth().getRedirectResult().then(function(result) {
        if (result.credential) {
          var token = result.credential.accessToken;
          var user_data = result.user.providerData[0];
          currentUid = user_data.uid;
      
          var usersRef = firebase.database().ref().child('users');
          usersRef.child(currentUid).once('value', function(snapshot) {
            if (snapshot.val() !== null &amp;&amp; snapshot.val().Phone !== undefined) {
              localStorage.setItem("UID", currentUid);
              localStorage.setItem("Name", user_data.displayName);
              window.location = "/zones"; //Navigate to this route
            } else {
  
            var userDataJson = {
              "Name": user_data.displayName,
              "Email": user_data.email,
              "Phone": user_data.phoneNumber
            };
  
            var childRef = usersRef.child(currentUid)
            childRef.set(userDataJson).then(snap =&gt; {
              localStorage.setItem("UID", currentUid);
              localStorage.setItem("Name", user_data.displayName);
              window.location = "/profile" ; //or Navigate to this route
              });
            }
          });
        }
      }).catch(function(error) {
          // Handle Errors here.
          var errorCode = error.code;
          var errorMessage = error.message;
          console.log(errorMessage);
          var email = error.email;
          var credential = error.credential;;
          });</code></pre>
  </div>
  </div>
  </p>
  
  <p>In Firebase console I have the following domains listed in Authorized Domains:
  1. localhost
  2. my firebase oauth domain
  3. my site domain that I'll be hosting the app on</p>
  
  <p>In the Facebook dev console I have listed the following in Valid OAuth redirect URIs:
  1.<a href="https://myblahblah.firebaseapp.com/__/auth/handler" rel="nofollow noreferrer">https://myblahblah.firebaseapp.com/__/auth/handler</a>
  2.<a href="https://mydomain/profile" rel="nofollow noreferrer">https://mydomain/profile</a>
  3.<a href="https://mydomain/zones" rel="nofollow noreferrer">https://mydomain/zones</a></p>
  
  <p>What am I doing wrong here, been trying to figure this out for hours!!</p>