Firebase Auth UI persistence of the user on the Web

0

I've been working with Firebase for quite some time. However, I'm fairly new to the Web topic. I intend to use Firebase Auth to authenticate users and, therefore, I will use Firebase Auth UI to simplify the process.

Although the authentication seems to work (I can see it in the Firebase console), for some reason the user's session ends just by jumping to another window of the same web page.

I've seen that persistence can be modified, but I do not know how to do it in the Firebase Auth UI. How can I do this?

Currently, the code I use to configure the Auth UI is the following:

        function doOnLoad(){
            var ui = new firebaseui.auth.AuthUI(firebase.auth());
            var uiConfig = {
                callbacks: {
                    signInSuccessWithAuthResult: function(authResult, redirectUrl) {
                        // User successfully signed in.
                        // Return type determines whether we continue the redirect automatically
                        // or whether we leave that to developer to handle.
                        return true;
                    },
                    uiShown: function() {
                        // The widget is rendered.
                        // Hide the loader.
                        document.getElementById('loader').style.display = 'none';
                    }
                },
                // Will use popup for IDP Providers sign-in flow instead of the default, redirect.
                signInFlow: 'popup',
                signInSuccessUrl: 'comprobacion.php',
                signInOptions: [
                    // Leave the lines as is for the providers you want to offer your users.
                    firebase.auth.GoogleAuthProvider.PROVIDER_ID,
                    firebase.auth.EmailAuthProvider.PROVIDER_ID
                ],
                // Terms of service url.
                tosUrl: '<your-tos-url>',
                // Privacy policy url.
                privacyPolicyUrl: '<your-privacy-policy-url>'
            };
            ui.start('#firebaseui-auth-container', uiConfig);
        }

When I try to recover it with var user = firebase.auth().currentUser; in another window of the same web, the value of user is null.

    
asked by Slifer Dragon 04.10.2018 в 12:12
source

0 answers