Firebase+Javascript Convert anonymous account to permanent - Error: response is not defined -


i'm trying build site user can first login anonymously using firebase , convert account permanent signing in facebook. i'm following instructions given @ https://firebase.google.com/docs/auth/web/anonymous-auth i'm getting following error "uncaught referenceerror: response not defined". tried converting account using google sign in error "googleuser not defined". doing wrong?

this code:-

  <html>   <body>     <button onclick = "anonymouslogin()">anonymous signin</butto>     <button onclick = "facebooksignin()">facebook signin</button>     <button onclick = "facebooksignout()">facebook signout</button>   </body>    <script>     function anonymouslogin(){           firebase.auth().signinanonymously().catch(function(error) {             // handle errors here.             var errorcode = error.code; console.log(errorcode)             var errormessage = error.message; console.log(errormessage)           });      }      function facebooksignin() {      var provider = new firebase.auth.facebookauthprovider();       var credential = firebase.auth.facebookauthprovider.credential(         response.authresponse.accesstoken);       auth.currentuser.link(credential).then(function(user) {        console.log("anonymous account upgraded", user);       }, function(error) {       console.log("error upgrading anonymous account", error);      });     }    </script> </html> 

okay found solution. apparently converting anonymous facebook user needs find token yourself. found workaround.

 var provider = new firebase.auth.facebookauthprovider();  firebase.auth().currentuser.linkwithpopup(provider) 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -