Improve Google Workspace authentication error handling and feedback
This commit is contained in:
@@ -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}`);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user