-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfirebase.html
67 lines (50 loc) · 1.52 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
60
61
62
63
64
65
66
67
<!Doctype <html>
<head>
<title></title>
<script src="https://www.gstatic.com/firebasejs/live/3.0/firebase.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.0.5/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/3.0.5/firebase-database.js"></script>
<script>
var config = {
var Firebase = require("firebase");
};
firebase.initializeApp(config);
</script>
//read and write data
<script>
var myFirebaseRef = new Firebase("https://grama-932e8.firebaseio.com/");
myFirebaseRef.set({
comment: "comment",
location: {
city: "San Francisco",
Country: "California",
}
});
myFirebaseRef.child("location/city").on("value", function(snapshot) {
alert(snapshot.val()); // Alerts "San Francisco"
});
</script>
<script>
// Initialize Firebase
var config = {
apiKey: "AIzaSyBYCu1Xqo74myQ-o1_AvLg2eRzNZ0f2Vco",
authDomain: "https://grama-932e8.firebaseapp.com/__/auth/handler",
databaseURL: "https://grama-932e8.firebaseio.com",
storageBucket: "grama-932e8.appspot.com",
};
firebase.initializeApp(config);
<!-- facebook oAuth -->
var ref = new Firebase("https://grama-932e8.firebaseio.com");
ref.authWithOAuthPopup("facebook", function(error, authData) {
if (error) {
console.log("Login Failed!", error);
} else {
console.log("Authenticated successfully with payload:", authData);
}
});
</script>
</head>
<body>
<!-- end facebook oAuth -->
</body>
</html>