mirror of
https://github.com/arc53/DocsGPT.git
synced 2025-11-30 17:13:15 +00:00
(feat:connectors) separate routes, namespace
This commit is contained in:
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user