Firebase Authentication redirecting to a blank pag

2019-08-17 01:43发布

问题:

Apps script sidebar redirects to a blank page after authenticating with Firebase Auth.

My Firebase Auth Implementation redirects to a blank page on apps script sidebar.

I implemented the code below from the official guide

<!DOCTYPE html>
<html>

<head>
    <meta charset="UTF-8">
    <title>Sample Firebase Auth App</title>
    <script src="https://www.gstatic.com/firebasejs/5.9.2/firebase.js"></script>
    <script>
        // Initialize Firebase
        var config = {
            apiKey: "",
            authDomain: "<project-id>.firebaseapp.com",
            databaseURL: "https://<project-id>.firebaseio.com",
            projectId: "<project-id>",
            storageBucket: "<project-id>.appspot.com",
            messagingSenderId: "6073*******"
        };
        firebase.initializeApp(config);
    </script>
</head>

<body>
    <h2>Login Form</h2>

    <form action="">

        <div class="container">
            <label for="email"><b>Email Address</b></label>
            <input type='text' placeholder='Enter Username' id='email' value='johndoe@foo.bar'>
            <br>
            <label for="psw"><b>Password</b></label>
            <input type="password" placeholder="Enter Password" id="psw" required>
            <br>
            <button onclick="login()">Login</button>

        </div>

    </form>

    <script>
        function login() {
            var email = document.getElementById("email").value;
            var password = document.getElementById("psw").value;

            if (email.length < 3 || password.length < 8) {
                return
            }

            firebase.auth().createUserWithEmailAndPassword(email, password).catch(function(error) {
                var errorCode = error.code;
                var errorMessage = error.message;

            });

        }
    </script>
</body>

</html>

is there an explanation for this behavior?