Improve Google Workspace authentication error handling and feedback

This commit is contained in:
2026-07-22 19:16:53 -04:00
parent a40d551820
commit 6e21854113
2 changed files with 161 additions and 12 deletions
+11 -4
View File
@@ -110,13 +110,20 @@ export const GoogleWorkspaceHub: React.FC<GoogleWorkspaceHubProps> = ({
email: res.user.email || 'connected@gmail.com',
name: res.user.displayName || 'Connected User'
});
showToast('Google Workspace connected successfully with Sheets, Drive, Docs & Keep!');
showToast('✓ Google Workspace connected successfully (Sheets, Drive, Docs & Keep permissions granted)!');
loadDriveFiles(res.accessToken);
}
} catch (err: any) {
// Friendly fallback status if popup was closed or environment mock
setIsConnected(true);
showToast('Connected in Workspace Sandbox mode.');
console.error("Google Sign-In Error Details:", err);
// Display actual error message to the user
const msg = err?.message || String(err);
if (msg.includes('popup-closed-by-user')) {
showToast('Sign-in window closed before completing.');
} else if (msg.includes('auth/unauthorized-domain')) {
showToast('Error: http://localhost:3000 needs to be added to Authorized Domains in Firebase Auth Console.');
} else {
showToast(`Google Sign-In Notice: ${msg}`);
}
}
};