-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth-callback.html
More file actions
122 lines (113 loc) · 3.98 KB
/
auth-callback.html
File metadata and controls
122 lines (113 loc) · 3.98 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="icon"
type="image/png"
href="/assets/Good-Native_Hover_App_Logo_Webflow.png"
/>
<title>Signing In...</title>
<link rel="stylesheet" href="/styles/app.css" />
<!-- Sentry Error Monitoring & Performance -->
<script
src="https://browser.sentry-cdn.com/10.38.0/bundle.tracing.replay.min.js"
integrity="sha384-XDXFmBaNWlQ7XLfEYTin+MajORWXtav1ePcSXtuFHSM8q1JXxmiihPepvYcZBLqD"
crossorigin="anonymous"
></script>
<script src="/js/sentry-init.js"></script>
<script>
window.GNH_APP = Object.assign({}, window.GNH_APP || {}, {
authCallback: true,
});
(function () {
const statusId = "authCallbackStatus";
function setStatus(message) {
const el = document.getElementById(statusId);
if (el) el.textContent = message;
}
function loadScript(src, attrs = {}, timeoutMs = 12000) {
return new Promise((resolve, reject) => {
const script = document.createElement("script");
script.src = src;
Object.entries(attrs).forEach(([key, value]) => {
if (value !== undefined && value !== null) {
script.setAttribute(key, String(value));
}
});
const timeoutId = window.setTimeout(() => {
script.remove();
reject(new Error(`Timed out loading ${src}`));
}, timeoutMs);
script.onload = () => {
window.clearTimeout(timeoutId);
resolve();
};
script.onerror = () => {
window.clearTimeout(timeoutId);
reject(new Error(`Failed loading ${src}`));
};
document.head.appendChild(script);
});
}
async function bootAuthCallback() {
try {
await loadScript("/config.js");
const supabaseSources = [
{
src: "https://unpkg.com/@supabase/supabase-js@2.80.0/dist/umd/supabase.js",
attrs: {
integrity:
"sha384-i0m00Vn1ERlKXxNWSa87g6OUB7eLxpmsQoNF68IHuQVtfJTebIca7XhFsYt9h/gN",
crossorigin: "anonymous",
},
},
{
src: "https://cdn.jsdelivr.net/npm/@supabase/supabase-js@2.80.0/dist/umd/supabase.js",
attrs: {
crossorigin: "anonymous",
},
},
];
let sdkLoaded = false;
let sdkError = null;
for (const candidate of supabaseSources) {
try {
await loadScript(candidate.src, candidate.attrs);
sdkLoaded = true;
break;
} catch (err) {
sdkError = err;
}
}
if (!sdkLoaded) {
throw sdkError || new Error("Failed to load Supabase SDK");
}
await loadScript("/js/auth.js");
const callbackHandler =
window.GNHAuth?.initAuthCallbackPage ||
window.initAuthCallbackPage;
if (typeof callbackHandler !== "function") {
throw new Error("Auth callback handler unavailable");
}
callbackHandler();
} catch (error) {
console.error("Auth callback bootstrap failed:", error);
setStatus(
"Sign-in callback failed to load. Please close this tab and try again."
);
}
}
window.addEventListener("DOMContentLoaded", bootAuthCallback, {
once: true,
});
})();
</script>
</head>
<body class="page-auth-callback">
<main aria-live="polite" style="padding: 24px; text-align: center">
<p id="authCallbackStatus">Signing you in...</p>
</main>
</body>
</html>