From e02a9b215366f9f55b6a3c71af9a3bb86eb6a54b Mon Sep 17 00:00:00 2001 From: chan Date: Wed, 14 Jan 2026 10:01:51 +0900 Subject: [PATCH] =?UTF-8?q?=ED=95=98=EB=93=9C=EC=BD=94=EB=94=A9=20?= =?UTF-8?q?=EB=B3=80=EC=88=98=20=EA=B4=80=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/internal/handler/auth_handler.go | 8 +++++--- frontend/lib/core/services/audit_service.dart | 2 +- frontend/lib/core/services/auth_proxy_service.dart | 3 +-- frontend/lib/features/auth/presentation/login_screen.dart | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/backend/internal/handler/auth_handler.go b/backend/internal/handler/auth_handler.go index 6632881b..a3d7c45f 100644 --- a/backend/internal/handler/auth_handler.go +++ b/backend/internal/handler/auth_handler.go @@ -141,9 +141,11 @@ func (h *AuthHandler) InitEnchantedLink(c *fiber.Ctx) error { h.RedisService.Set(prefixToken+token, fmt.Sprintf(`{"pendingRef":"%s","loginId":"%s"}`, pendingRef, loginID), defaultExpiration) // Send SMS - // Frontend URL should be dynamic or env based, but restoring hardcoded/env logic - // The frontend uses ssologin.hmac.kr - frontendURL := "http://ssologin.hmac.kr" + // Frontend URL should be dynamic or env based + frontendURL := os.Getenv("FRONTEND_URL") + if frontendURL == "" { + frontendURL = "http://ssologin.hmac.kr" + } link := fmt.Sprintf("%s/verify/%s", frontendURL, token) content := fmt.Sprintf("[Baron SSO] 로그인 링크: %s", link) diff --git a/frontend/lib/core/services/audit_service.dart b/frontend/lib/core/services/audit_service.dart index b2ec6090..02bb81a4 100644 --- a/frontend/lib/core/services/audit_service.dart +++ b/frontend/lib/core/services/audit_service.dart @@ -3,7 +3,7 @@ import 'package:http/http.dart' as http; import 'package:flutter_dotenv/flutter_dotenv.dart'; class AuditService { - static const String _baseUrl = 'https://ssologin.hmac.kr'; + static String get _baseUrl => dotenv.env['BACKEND_URL'] ?? 'https://ssologin.hmac.kr'; static Future logEvent({ required String userId, diff --git a/frontend/lib/core/services/auth_proxy_service.dart b/frontend/lib/core/services/auth_proxy_service.dart index 858afd56..6b6d4aa5 100644 --- a/frontend/lib/core/services/auth_proxy_service.dart +++ b/frontend/lib/core/services/auth_proxy_service.dart @@ -3,8 +3,7 @@ import 'package:http/http.dart' as http; import 'package:flutter_dotenv/flutter_dotenv.dart'; class AuthProxyService { - // HARDCODED URL - static const String _baseUrl = 'https://ssologin.hmac.kr'; + static String get _baseUrl => dotenv.env['BACKEND_URL'] ?? 'https://ssologin.hmac.kr'; static Future> initEnchantedLink(String loginId, {String? method}) async { final url = Uri.parse('$_baseUrl/api/v1/auth/enchanted-link/init'); diff --git a/frontend/lib/features/auth/presentation/login_screen.dart b/frontend/lib/features/auth/presentation/login_screen.dart index bf5a7e3c..79bc891a 100644 --- a/frontend/lib/features/auth/presentation/login_screen.dart +++ b/frontend/lib/features/auth/presentation/login_screen.dart @@ -222,9 +222,10 @@ class _LoginScreenState extends ConsumerState } // 1. Init via Descope SDK + final frontendUrl = dotenv.env['FRONTEND_URL'] ?? 'http://ssologin.hmac.kr'; final signUpOrInResponse = await Descope.enchantedLink.signUpOrIn( loginId: loginId, - redirectUrl: "http://ssologin.hmac.kr/auth/callback", + redirectUrl: "$frontendUrl/auth/callback", ); if (mounted) {