-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
80 lines (64 loc) · 2.76 KB
/
index.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
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="google-signin-client_id"
content="224025770478-fgnvdgjp81e9rfs2nig83innciis9n4u.apps.googleusercontent.com">
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script src="https://apis.google.com/js/platform.js" async defer></script>
<script type="text/javascript" src="memlist.json"></script>
<script src="https://www.gstatic.com/firebasejs/8.6.8/firebase.js"></script>
<!-- TODO: Add SDKs for Firebase products that you want to use
https://firebase.google.com/docs/web/setup#available-libraries -->
</head>
<body>
<div class="g-signin2" data-onsuccess="onSignIn"></div>
<button>
<a href="https://chat.whatsapp.com/KXOcJf5DIKkKvkkumDijVt">
Test Link
</a>
</button>
<script>
var email;
var firebaseConfig = {
apiKey: "AIzaSyBpJ50cUazZkRyAquQ9hNyckJO6HchuRPg",
authDomain: "telegramauth2.firebaseapp.com",
databaseURL: "https://telegramauth2-default-rtdb.firebaseio.com",
projectId: "telegramauth2",
storageBucket: "telegramauth2.appspot.com",
messagingSenderId: "762660936918",
appId: "1:762660936918:web:6db63fb3c7265619babd77",
measurementId: "G-KZFM2WBCLK"
};
// Initialize Firebase
firebase.initializeApp(firebaseConfig);
//firebase.analytics();
var database = firebase.database();
const dbRef = firebase.database().ref();
function onSignIn(googleUser) {
var profile = googleUser.getBasicProfile();
email = profile.getEmail();
console.log('ID: ' + profile.getId()); // Do not send to your backend! Use an ID token instead.
console.log('Name: ' + profile.getName());
console.log('Image URL: ' + profile.getImageUrl());
console.log('Email: ' + profile.getEmail()); // This is null if the 'email' scope is not present.
dbRef.child("0").child(email).get().then((snapshot) => {
if (snapshot.exists()) {
console.log(snapshot.val());
} else {
console.log("No data available");
}
}).catch((error) => {
console.error(error);
});
}
//var abcd = [{"name" : "sandeep"},{"name" :"Ramesh"}];
//abcd = JSON.parse(abcd);
//for (var index = 0; index < abcd.length; index++) {
// alert(abcd[i].name);
//}
</script>
</body>
</html>