(feat:connectors) separate routes, namespace

This commit is contained in:
ManishMadan2882
2025-08-28 00:51:09 +05:30
parent 578c68205a
commit 4065041a9f
4 changed files with 584 additions and 463 deletions

View File

@@ -70,10 +70,10 @@
}
try {
// Exchange code for tokens
// Use the backend API URL directly since this is a static HTML file
const backendApiUrl = window.location.protocol + '//' + window.location.hostname + ':7091';
const response = await fetch(backendApiUrl + '/api/google-drive/callback?' + window.location.search.substring(1));
const urlParams = new URLSearchParams(window.location.search);
urlParams.set('provider', 'google_drive');
const response = await fetch(backendApiUrl + '/api/connectors/callback?' + urlParams.toString());
const data = await response.json();
if (data.success) {
@@ -81,15 +81,13 @@
if (data.session_token) {
localStorage.setItem('google_drive_session_token', data.session_token);
}
// Extract user email
let userEmail = data.user_email || 'Connected User';
statusDiv.className = 'success';
statusDiv.innerHTML = `Authentication successful as ${userEmail}!<br><br>
<small>You can close this window. Your Google Drive is now connected and ready to use.</small>`;
// Notify parent window with session token instead of token_info
if (window.opener) {
window.opener.postMessage({
type: 'google_drive_auth_success',
@@ -110,7 +108,6 @@
}
}
// Run when page loads
handleCallback();
</script>
</body>