From aa6c54a692f63f864b4349f337ba472892e83ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zieli=C5=84ski?= Date: Tue, 25 Nov 2025 23:30:18 +0100 Subject: [PATCH] auth fix --- src/Backend/DiunaBI.UI.Shared/Components/LoginCard.razor | 7 +++++-- src/Backend/DiunaBI.UI.Shared/wwwroot/js/auth.js | 2 -- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Backend/DiunaBI.UI.Shared/Components/LoginCard.razor b/src/Backend/DiunaBI.UI.Shared/Components/LoginCard.razor index 5e1572f..6f8b223 100644 --- a/src/Backend/DiunaBI.UI.Shared/Components/LoginCard.razor +++ b/src/Backend/DiunaBI.UI.Shared/Components/LoginCard.razor @@ -52,8 +52,11 @@ { _instance = this; - // Only initialize JavaScript Google SDK if we're NOT using platform-specific auth (i.e., web) - if (GoogleAuthService == null) + // Initialize JavaScript Google SDK for web (both null service and WebGoogleAuthService) + // Skip only for mobile platform-specific auth (MobileGoogleAuthService) + var isMobileAuth = GoogleAuthService != null && GoogleAuthService.GetType().Name == "MobileGoogleAuthService"; + + if (!isMobileAuth) { await InitializeGoogleSignIn(); } diff --git a/src/Backend/DiunaBI.UI.Shared/wwwroot/js/auth.js b/src/Backend/DiunaBI.UI.Shared/wwwroot/js/auth.js index 34a97c8..f175685 100644 --- a/src/Backend/DiunaBI.UI.Shared/wwwroot/js/auth.js +++ b/src/Backend/DiunaBI.UI.Shared/wwwroot/js/auth.js @@ -22,7 +22,6 @@ window.initGoogleSignIn = function(clientId) { throw new Error("Google Sign-In library not ready"); } - // Używamy google.accounts.id - zwraca ID token (JWT credential) google.accounts.id.initialize({ client_id: clientId, callback: handleCredentialResponse, @@ -37,7 +36,6 @@ window.initGoogleSignIn = function(clientId) { window.requestGoogleSignIn = function() { console.log("🚀 Requesting Google Sign-In..."); - // Pokaż One Tap prompt (without deprecated notification callbacks for FedCM compatibility) google.accounts.id.prompt(); };