This commit is contained in:
MartinBraquet
2025-10-30 12:46:25 +01:00
parent 2c1c94d24c
commit ccde6e4f4b
2 changed files with 18 additions and 27 deletions

View File

@@ -1,27 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Redirecting...</title>
<script>
(function() {
// Extract query string (includes ?code=...&state=...)
const params = new URLSearchParams(window.location.search);
const code = params.get('code');
const state = params.get('state');
console.log('/auth/callback code', code);
if (code) {
// Send code back to native app
const deepLink = `com.compassmeet://auth?code=${encodeURIComponent(code)}&state=${encodeURIComponent(state || '')}`;
window.location.href = deepLink;
} else {
document.body.textContent = 'Missing code in redirect.';
}
})();
</script>
</head>
<body>
Redirecting to app...
</body>
</html>

View File

@@ -0,0 +1,18 @@
import {useEffect} from "react";
export default function GoogleAuthCallback() {
useEffect(() => {
const params = new URLSearchParams(window.location.search);
const code = params.get('code');
const state = params.get('state');
console.log('/auth/callback code', code);
if (code) {
// Send code back to native app
const deepLink = `com.compassmeet://auth?code=${encodeURIComponent(code)}&state=${encodeURIComponent(state || '')}`;
window.location.href = deepLink;
} else {
document.body.textContent = 'Missing code in redirect.';
}
}, []);
}