Update signing.html
Browse files- signing.html +5 -3
signing.html
CHANGED
|
@@ -73,7 +73,9 @@
|
|
| 73 |
<!-- Firebase SDK -->
|
| 74 |
<script type="module">
|
| 75 |
import { initializeApp } from 'https://www.gstatic.com/firebasejs/10.7.1/firebase-app.js';
|
| 76 |
-
import { getAuth, signInWithPopup,
|
|
|
|
|
|
|
| 77 |
|
| 78 |
// Firebase configuration - REPLACE WITH YOUR CONFIG
|
| 79 |
const firebaseConfig = {
|
|
@@ -115,7 +117,7 @@
|
|
| 115 |
loadingEl.style.display = 'block';
|
| 116 |
errorEl.textContent = '';
|
| 117 |
|
| 118 |
-
const result = await signInWithPopup(auth, provider);
|
| 119 |
const user = result.user;
|
| 120 |
const credential = GoogleAuthProvider.credentialFromResult(result);
|
| 121 |
const token = await user.getIdToken();
|
|
@@ -132,7 +134,7 @@
|
|
| 132 |
buttonEl.disabled = false;
|
| 133 |
loadingEl.style.display = 'none';
|
| 134 |
|
| 135 |
-
let errorMessage =
|
| 136 |
if (error.code === 'auth/popup-closed-by-user') {
|
| 137 |
errorMessage = 'Sign-in cancelled. Please try again.';
|
| 138 |
} else if (error.code === 'auth/popup-blocked') {
|
|
|
|
| 73 |
<!-- Firebase SDK -->
|
| 74 |
<script type="module">
|
| 75 |
import { initializeApp } from 'https://www.gstatic.com/firebasejs/10.7.1/firebase-app.js';
|
| 76 |
+
import { getAuth, signInWithPopup,
|
| 77 |
+
signInWithRedirect,
|
| 78 |
+
GoogleAuthProvider, onAuthStateChanged } from 'https://www.gstatic.com/firebasejs/10.7.1/firebase-auth.js';
|
| 79 |
|
| 80 |
// Firebase configuration - REPLACE WITH YOUR CONFIG
|
| 81 |
const firebaseConfig = {
|
|
|
|
| 117 |
loadingEl.style.display = 'block';
|
| 118 |
errorEl.textContent = '';
|
| 119 |
|
| 120 |
+
const result = signInWithRedirect(auth, provider); // await signInWithPopup(auth, provider);
|
| 121 |
const user = result.user;
|
| 122 |
const credential = GoogleAuthProvider.credentialFromResult(result);
|
| 123 |
const token = await user.getIdToken();
|
|
|
|
| 134 |
buttonEl.disabled = false;
|
| 135 |
loadingEl.style.display = 'none';
|
| 136 |
|
| 137 |
+
let errorMessage = `Authentication failed. Please try again.`;
|
| 138 |
if (error.code === 'auth/popup-closed-by-user') {
|
| 139 |
errorMessage = 'Sign-in cancelled. Please try again.';
|
| 140 |
} else if (error.code === 'auth/popup-blocked') {
|