-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
68 lines (59 loc) · 2.11 KB
/
index.html
File metadata and controls
68 lines (59 loc) · 2.11 KB
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
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8" />
<title>ARC Auth</title>
<!-- Firebase (compat mode for v10+) -->
<script src="https://www.gstatic.com/firebasejs/10.5.0/firebase-app-compat.js"></script>
<script src="https://www.gstatic.com/firebasejs/10.5.0/firebase-auth-compat.js"></script>
<!-- FirebaseUI (auth form) -->
<script src="https://www.gstatic.com/firebasejs/ui/6.0.2/firebase-ui-auth.js"></script>
<link type="text/css" rel="stylesheet" href="https://www.gstatic.com/firebasejs/ui/6.0.2/firebase-ui-auth.css" />
<style>
body {
font-family: sans-serif;
text-align: center;
padding-top: 5rem;
}
</style>
</head>
<body>
<h2>ARC Login</h2>
<div id="firebaseui-auth-container"></div>
<div id="logged-in-content" style="display:none;">
<p>Welcome! You’re logged in.</p>
<button onclick="logout()">Log out</button>
</div>
<script>
const firebaseConfig = {
apiKey: "AIzaSyDSDdXbJtEHiHDH1pFDYtcsX9DA2t7dgnw",
authDomain: "arc-login-149e8.firebaseapp.com",
projectId: "arc-login-149e8",
storageBucket: "arc-login-149e8.appspot.com",
messagingSenderId: "850922873921",
appId: "1:850922873921:web:e402b79f1d2559277312c0",
measurementId: "G-YFB5R5RK7M"
};
firebase.initializeApp(firebaseConfig);
const uiConfig = {
signInOptions: [
firebase.auth.EmailAuthProvider.PROVIDER_ID,
firebase.auth.GoogleAuthProvider.PROVIDER_ID
],
signInSuccessUrl: window.location.href // stay on this page after login
};
const ui = new firebaseui.auth.AuthUI(firebase.auth());
firebase.auth().onAuthStateChanged(user => {
if (user) {
document.getElementById("firebaseui-auth-container").style.display = "none";
document.getElementById("logged-in-content").style.display = "block";
} else {
ui.start('#firebaseui-auth-container', uiConfig);
}
});
function logout() {
firebase.auth().signOut();
}
</script>
</body>
</html>