From 21b9594de5ba65f89bcfb466cdfa4872907f14a7 Mon Sep 17 00:00:00 2001 From: chan Date: Wed, 11 Feb 2026 17:51:11 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20userfront=20=EB=B9=8C=EB=93=9C=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95(--wasm=20=EC=A0=9C=EA=B1=B0)=20=EB=B0=8F=20?= =?UTF-8?q?=EB=A6=AC=EB=8B=A4=EC=9D=B4=EB=A0=89=EC=85=98=20=EB=A1=9C?= =?UTF-8?q?=EC=A7=81=20=EC=B5=9C=EC=A2=85=20=EB=B0=98=EC=98=81=20#243?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- userfront/Dockerfile | 2 +- .../services/web_auth_integration_web.dart | 30 ++++++++++++++++++- 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/userfront/Dockerfile b/userfront/Dockerfile index aab98a00..47052a28 100644 --- a/userfront/Dockerfile +++ b/userfront/Dockerfile @@ -7,7 +7,7 @@ COPY . . # Get dependencies and build for web RUN flutter pub get RUN touch .env -RUN flutter build web --release --no-tree-shake-icons --wasm +RUN flutter build web --release --no-tree-shake-icons # Stage 2: Serve with Nginx FROM nginx:alpine diff --git a/userfront/lib/core/services/web_auth_integration_web.dart b/userfront/lib/core/services/web_auth_integration_web.dart index 996a1a26..6687e544 100644 --- a/userfront/lib/core/services/web_auth_integration_web.dart +++ b/userfront/lib/core/services/web_auth_integration_web.dart @@ -11,8 +11,36 @@ void implSendLoginSuccess(String token) { effectiveToken = AuthTokenStore.getToken() ?? ""; } + final fullUrl = html.window.location.href; final uri = Uri.base; - final redirectUri = uri.queryParameters['redirect_uri'] ?? uri.queryParameters['redirect_url']; + + // Try to find redirect_uri from standard parsing first, then manual string search + String? redirectUri = uri.queryParameters['redirect_uri'] ?? uri.queryParameters['redirect_url']; + + if (redirectUri == null) { + // Manual fallback for cases where Uri.base misses params + final searchParams = html.window.location.search; + if (searchParams != null && searchParams.isNotEmpty) { + final sUri = Uri.parse('?${searchParams.startsWith('?') ? searchParams.substring(1) : searchParams}'); + redirectUri = sUri.queryParameters['redirect_uri'] ?? sUri.queryParameters['redirect_url']; + } + } + + // Final fallback: regex or manual search in fullUrl + if (redirectUri == null) { + for (final key in ['redirect_uri=', 'redirect_url=']) { + if (fullUrl.contains(key)) { + final start = fullUrl.indexOf(key) + key.length; + var end = fullUrl.indexOf('&', start); + if (end == -1) end = fullUrl.length; + final raw = fullUrl.substring(start, end); + try { + redirectUri = Uri.decodeComponent(raw); + break; + } catch (_) {} + } + } + } if (redirectUri != null && redirectUri.isNotEmpty) { // Redirection flow