简体   繁体   中英

Redirecting to another page after sign in with google - Firebase Web

Everything is working fine. Sign in with google is working. I want to know what I need to add in my googlesignin function so that after sign in with google, it is redirected to facebook.html page?

Button code <button onclick="googleSignin()">Google Signin</button>

 function googleSignin(){
   base_provider = new firebase.auth.GoogleAuthProvider()
   firebase.auth().signInWithRedirect(base_provider).then(function(result){
      console.log(result)
      console.log("Success.. Google Account Linked")
   }).catch(function(err){
      console.log(err)
      console.log("Failed to do")
   })
}

I found the answer and I would like to share with everyone.

function googleSignin(){
   base_provider = new firebase.auth.GoogleAuthProvider()
   firebase.auth().signInWithPopup(base_provider).then(function(result){ 
     window.location="facebook.html";
      console.log(result)
      console.log("Success.. Google Account Linked")
   }).catch(function(err){
      console.log(err)
      console.log("Failed to do")
   })
}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM