forked from HackTheStacks/metabunz
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirebase.html
59 lines (37 loc) · 1.23 KB
/
firebase.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<html>
<head>
</head>
<body>
<h1 id= "bigONE"></h1>
<div id ="yup">
<a id = "btnLogin" href="#"> Login Anonymously </a>
</div>
<script src="https://www.gstatic.com/firebasejs/3.6.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.6.1/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.6.1/firebase-database.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.6.1/firebase-messaging.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.6.1/firebase.js"></script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyC_RWVS2jorTZQkVeBhOjN9su3DgvAiIbk",
authDomain: "metabunz-c4c1c.firebaseapp.com",
databaseURL: "https://metabunz-c4c1c.firebaseio.com",
storageBucket: "metabunz-c4c1c.appspot.com",
messagingSenderId: "250690832922"
};
firebase.initializeApp(config);
//get elements
var btnLogin = document.getElementById('btnLogin');
var btnLogout = document.getElementById('btnLogout');
//click event listen
btnLogin.addEventListener('click', e=> {
firebase.auth().signInAnonymously();
});
//auth listener
firebase.auth().onAuthStateChanged(firebaseUser =>{
console.log(firebaseUser);
});
</script>
</body>
</html>