'Firebase Web - Google sign-in with "redirect" option not redirecting but "popup" option works. What am I missing?

I am trying to use Google sign-in with firebase web for my vuejs app. Firebase's google sign-in gives two options - with redirect and popup to sign in. After successful sign-in, I want to redirect the user to a specific page. This works with pop-up method but with redirect, it signs in the user but comes back to the login page. Is there a property I need to set to get this working? My code snippet below:

firebase.auth().signInWithPopup(provider).then(function(result) {
// This gives you a Google Access Token. You can use it to access the Google API.
   var token = result.credential.accessToken;
// The signed-in user info.
   var user = result.user;
   that.navToLogin();   //---> this works with signInWithPopup
});

firebase.auth().signInWithRedirect(provider).then(function(result) {
 //user gets signed in but it does not redirect to a new page
   that.navToLogin(); //---> this does not work
});

//Below didn't work either:

firebase.auth().signInWithRedirect(provider);

firebase.auth().getRedirectResult().then(function(result) {
 if (result.credential) {
   // This gives you a Google Access Token. You can use it to access the Google API.
   var token = result.credential.accessToken;
   that.navToLogin(); //---> this does not work
 }
 // The signed-in user info.
 var user = result.user;
})


Solution 1:[1]

This seems to be duplicated. You can get an explanation about how redirecting behaves here:

Firebase Google signInWithRedirect not redirecting to specified page on successful authentication

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Nelson La Rocca