title: How to convert an anonymous account to a permanent account
body: <p>can someone help me how to convert an anonymous account (signInAnonymouslyAndRetrieveData) to a permanent account ?
  I have tried this:</p>
  
  <pre><code>firebase.auth().currentUser.linkAndRetrieveDataWithCredential(credential).then(function(usercred) {
    var user = usercred.user;
    console.log("Anonymous account successfully upgraded", user);
  }, function(error) {
    console.log("Error upgrading anonymous account", error);
  });
  </code></pre>
  
  <p>but i'm getting an </p>
  
  <blockquote>
    <p>cannot read property "linkAndRetrieveDataWithCredential" of null</p>
  </blockquote>
  
  <p>error.</p>