-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
52 lines (43 loc) · 1.4 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<link href="assets/css/bootstrap.css" rel="stylesheet">
<link href="assets/css/style.css" rel="stylesheet">
<title>Electron Twitter Login Example</title>
</head>
<body>
<div>
<div class="container">
<div class="row text-center card">
<button class="btn twitter-button" onclick="twitterLogin()"> Twitter Login </button>
</br>
<div class="email"></div>
</div>
</div>
</div>
<script src="assets/js/jquery.js"></script>
<script>
const {ipcRenderer} = require('electron');
function twitterLogin() {
ipcRenderer.send("do-twitter-login");
ipcRenderer.on("twitter-login", (event, response) => {
if (!response.error) {
//obtaining credential from oAuthToken and oAuthSecret using firebase
var credential = window.firebase.auth.TwitterAuthProvider.credential(
response.accessToken,
response.accessTokenSecret
);
window.firebase.auth().signInWithCredential(credential)
.then((result) => {
$(".email").html(result.user.email)
})
.catch((error) => {
console.log(error);
});
}
});
}
</script>
</body>
</html>