🐛 Fixes the callback page
This commit is contained in:
parent
3b9db74a34
commit
aba0f6b5e2
@ -18,12 +18,14 @@
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
const token = urlParams.get('token');
|
||||
|
||||
if (token) {
|
||||
console.log("Authentication token received.");
|
||||
|
||||
// For WebView2/UWP apps that can handle window.external.notify
|
||||
if (window.external && typeof window.external.notify === 'function') {
|
||||
try {
|
||||
if (!token)
|
||||
window.external.notify('done');
|
||||
else
|
||||
window.external.notify(token);
|
||||
console.log("Token sent via window.external.notify.");
|
||||
return; // Exit after successful notification
|
||||
@ -34,17 +36,12 @@
|
||||
|
||||
// For mobile apps that use custom URI schemes
|
||||
try {
|
||||
const customSchemeUrl = `dyson://auth?token=${encodeURIComponent(token)}`;
|
||||
const customSchemeUrl = `solian://auth/callback?token=${encodeURIComponent(token ?? 'done')}`;
|
||||
window.location.href = customSchemeUrl;
|
||||
console.log("Attempting to redirect to custom scheme:", customSchemeUrl);
|
||||
} catch (e) {
|
||||
console.error("Failed to redirect to custom scheme:", e);
|
||||
}
|
||||
|
||||
} else {
|
||||
console.error("Authentication token not found in URL.");
|
||||
document.querySelector('p').innerText = "Authentication failed: No token was provided.";
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user