From 3b03c52cd4d857920a173dc600eb7f58db2f7aba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Zieli=C5=84ski?= Date: Wed, 19 Nov 2025 18:30:55 +0100 Subject: [PATCH] auth fix --- .../Services/GoogleSheetsHelper.cs | 13 +++---------- src/Backend/DiunaBI.UI.Shared/wwwroot/js/auth.js | 14 +++----------- 2 files changed, 6 insertions(+), 21 deletions(-) diff --git a/src/Backend/DiunaBI.Infrastructure/Services/GoogleSheetsHelper.cs b/src/Backend/DiunaBI.Infrastructure/Services/GoogleSheetsHelper.cs index c099bb5..07a3f87 100644 --- a/src/Backend/DiunaBI.Infrastructure/Services/GoogleSheetsHelper.cs +++ b/src/Backend/DiunaBI.Infrastructure/Services/GoogleSheetsHelper.cs @@ -32,13 +32,7 @@ public class GoogleSheetsHelper if (string.IsNullOrWhiteSpace(json)) throw new InvalidOperationException("GOOGLE_SERVICE_ACCOUNT_JSON environment variable is not set."); - Console.WriteLine($"[GoogleSheetsHelper] Original JSON length: {json.Length}"); - Console.WriteLine($"[GoogleSheetsHelper] First 200 chars: {json.Substring(0, Math.Min(200, json.Length))}"); - - // Replace literal \n with actual newlines - json = json.Replace("\\n", "\n"); - - Console.WriteLine($"[GoogleSheetsHelper] After replacement, first 200 chars: {json.Substring(0, Math.Min(200, json.Length))}"); + Console.WriteLine($"[GoogleSheetsHelper] Loading credentials from environment variable (length: {json.Length})"); try { @@ -46,9 +40,8 @@ public class GoogleSheetsHelper } catch (Exception ex) { - Console.WriteLine($"[GoogleSheetsHelper] ERROR parsing JSON: {ex.Message}"); - Console.WriteLine($"[GoogleSheetsHelper] JSON being parsed: {json}"); - throw; + Console.WriteLine($"[GoogleSheetsHelper] ERROR: Failed to parse credentials - {ex.Message}"); + throw new InvalidOperationException("Failed to parse Google service account credentials. Ensure GOOGLE_SERVICE_ACCOUNT_JSON is properly formatted.", ex); } #endif } diff --git a/src/Backend/DiunaBI.UI.Shared/wwwroot/js/auth.js b/src/Backend/DiunaBI.UI.Shared/wwwroot/js/auth.js index c18ffd1..34a97c8 100644 --- a/src/Backend/DiunaBI.UI.Shared/wwwroot/js/auth.js +++ b/src/Backend/DiunaBI.UI.Shared/wwwroot/js/auth.js @@ -36,17 +36,9 @@ window.initGoogleSignIn = function(clientId) { window.requestGoogleSignIn = function() { console.log("🚀 Requesting Google Sign-In..."); - - // Pokaż One Tap prompt - google.accounts.id.prompt((notification) => { - if (notification.isNotDisplayed()) { - console.warn("⚠️ One Tap not displayed:", notification.getNotDisplayedReason()); - } else if (notification.isSkippedMoment()) { - console.warn("⚠️ One Tap skipped:", notification.getSkippedReason()); - } else { - console.log("✅ One Tap displayed"); - } - }); + + // Pokaż One Tap prompt (without deprecated notification callbacks for FedCM compatibility) + google.accounts.id.prompt(); }; function handleCredentialResponse(response) {