Convert anonymous user to permanent (google & facebook)

Hello Prof.

i have an app that uses firebase anonymous authentication , i need to convert anonymous signed in user to permanent , i followed the firebase docs Anonymous auth. docs with no luck , anyone has done this , please share .

Many thanks.

the issue solved , here is what i have done for anyone has the same problem ,

 var provider = new firebase.auth.GoogleAuthProvider();
 firebase.auth().currentUser.linkWithRedirect(provider).then(function() {
                firebase.auth().getRedirectResult().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;
                    console.log('result '+ result);
                    // debugger;
                  }).catch(function(error) {
                    // Handle Errors here.
                    var errorCode = error.code;
                    var errorMessage = error.message;
                    // debugger;