<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <script src="https://www.gstatic.com/firebasejs/5.7.0/firebase.js"></script>
    <script>
        // Initialize Firebase
        var config = {
            apiKey: "AIzaSyCuvwf78cmSDoZ2yS4XxHZhnjUn7yIHYfw",
            authDomain: "test-667ca.firebaseapp.com",
            databaseURL: "https://test-667ca.firebaseio.com",
            projectId: "test-667ca",
            storageBucket: "test-667ca.appspot.com",
            messagingSenderId: "221332577314"
        };
        firebase.initializeApp(config);

        function checkAuth() {
            firebase.auth().onAuthStateChanged(async function (user) {
                if (user) {
                    try {
                        firebase.auth().currentUser.getIdToken( /* forceRefresh */ true).then(function (
                            idToken) {
                            console.log("Vor Replace");
                            window.location.replace("/invite/" + idToken + "/" + invitelink);
                        }).catch(function (error) {
                            console.error("Get id token client error: ", error)
                        });
                    } catch {
                        console.error("checkAuth error: ")
                    }

                    // document.getElementById("loginbutton").style.display = "none";
                    // 
                } else {
                    // document.getElementById("loginbutton").style.display = "block";
                    console.log("Check Auth error", user)
                }
            })
            var user = firebase.auth().currentUser;
        }
        window.onload = function () {
            checkAuth();
        }
    </script>
</head>

<body>

</body>

</html>