Files
databasus/storages/google-oauth/index.html
Rostislav Dugin 042e10c49c Revert "FEATURE (ssr): Migrate to NextJS"
This reverts commit b06e6043f9.
2025-11-09 17:53:59 +03:00

47 lines
1.5 KiB
HTML

<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="robots" content="noindex, nofollow" />
<title>Google OAuth - Redirecting...</title>
</head>
<body>
<div style="text-align: center; padding: 50px; font-family: Arial, sans-serif">
<h2>Processing OAuth...</h2>
<p>Please wait while we redirect you back to the application.</p>
</div>
<script>
window.onload = function () {
// Get current URL parameters
const urlParams = new URLSearchParams(window.location.search);
// Extract state and code from current URL
const state = urlParams.get('state');
const code = urlParams.get('code');
if (state && code) {
try {
// Parse the StorageOauthDto from the state parameter
const oauthDto = JSON.parse(decodeURIComponent(state));
// Update the authCode field with the received code
oauthDto.authCode = code;
// Construct the redirect URL with the updated DTO
const redirectUrl = `${oauthDto.redirectUrl}?oauthDto=${encodeURIComponent(JSON.stringify(oauthDto))}`;
// Redirect to the constructed URL
window.location.href = redirectUrl;
} catch (error) {
console.error('Error parsing state parameter:', error);
}
} else {
console.error('Missing state or code parameter');
}
};
</script>
</body>
</html>