diff --git a/gateway/html/dashboard.html b/gateway/html/dashboard.html
index 056f828..ea0f02a 100644
--- a/gateway/html/dashboard.html
+++ b/gateway/html/dashboard.html
@@ -781,7 +781,8 @@
var redirect = new URLSearchParams(location.search).get('redirect');
if (redirect && isSafeRedirect(redirect)) {
- window.location.href = redirect;
+ var sep = redirect.indexOf('#') === -1 ? '#' : '&';
+ window.location.href = redirect + sep + '_sso=' + encodeURIComponent(data.access_token);
} else {
window.location.href = '/dashboard';
}
@@ -840,7 +841,8 @@
// Already logged in + redirect param
var redirect = params.get('redirect');
if (redirect && isSafeRedirect(redirect)) {
- window.location.href = redirect;
+ var sep = redirect.indexOf('#') === -1 ? '#' : '&';
+ window.location.href = redirect + sep + '_sso=' + encodeURIComponent(token);
return;
}
diff --git a/shared/frontend/sso-relay.js b/shared/frontend/sso-relay.js
new file mode 100644
index 0000000..820bdb1
--- /dev/null
+++ b/shared/frontend/sso-relay.js
@@ -0,0 +1,39 @@
+/**
+ * SSO Token Relay — 인앱 브라우저(카카오톡 등) 서브도메인 쿠키 미공유 대응
+ *
+ * Canonical source: shared/frontend/sso-relay.js
+ * 전 서비스 동일 코드 — 수정 시 아래 파일 ���체 갱신 필요:
+ * system1-factory/web/js/sso-relay.js
+ * system2-report/web/js/sso-relay.js
+ * system3-nonconformance/web/static/js/sso-relay.js
+ * user-management/web/static/js/sso-relay.js
+ * tkpurchase/web/static/js/sso-relay.js
+ * tksafety/web/static/js/sso-relay.js
+ * tksupport/web/static/js/sso-relay.js
+ *
+ * 동작: URL hash에 _sso= 파라미터가 있으면 토큰을 로컬 쿠키+localStorage에 설정하고 hash를 제거.
+ * gateway/dashboard.html에서 로그인 성공 후 redirect URL에 #_sso=을 붙여 전달.
+ */
+(function() {
+ var hash = location.hash;
+ if (!hash || hash.indexOf('_sso=') === -1) return;
+
+ var match = hash.match(/[#&]_sso=([^&]*)/);
+ if (!match) return;
+
+ var token = decodeURIComponent(match[1]);
+ if (!token) return;
+
+ // 로컬(1st-party) 쿠키 설정
+ var cookie = 'sso_token=' + encodeURIComponent(token) + '; path=/; max-age=604800';
+ if (location.hostname.indexOf('technicalkorea.net') !== -1) {
+ cookie += '; domain=.technicalkorea.net; secure; samesite=lax';
+ }
+ document.cookie = cookie;
+
+ // localStorage 폴백
+ try { localStorage.setItem('sso_token', token); } catch (e) {}
+
+ // URL에서 hash 제거
+ history.replaceState(null, '', location.pathname + location.search);
+})();
diff --git a/system1-factory/web/index.html b/system1-factory/web/index.html
index 9a4421d..44a390e 100644
--- a/system1-factory/web/index.html
+++ b/system1-factory/web/index.html
@@ -10,6 +10,7 @@
if('serviceWorker' in navigator){navigator.serviceWorker.getRegistrations().then(function(r){r.forEach(function(reg){reg.unregister()});})}
if('caches' in window){caches.keys().then(function(k){k.forEach(function(key){caches.delete(key)})})}
+
diff --git a/system1-factory/web/pages/admin/equipment-detail.html b/system1-factory/web/pages/admin/equipment-detail.html
index c943064..f6f8b13 100644
--- a/system1-factory/web/pages/admin/equipment-detail.html
+++ b/system1-factory/web/pages/admin/equipment-detail.html
@@ -314,6 +314,7 @@
+
diff --git a/system1-factory/web/pages/admin/equipments.html b/system1-factory/web/pages/admin/equipments.html
index a27223a..d0736e0 100644
--- a/system1-factory/web/pages/admin/equipments.html
+++ b/system1-factory/web/pages/admin/equipments.html
@@ -190,6 +190,7 @@
+
diff --git a/system1-factory/web/pages/admin/purchase-analysis.html b/system1-factory/web/pages/admin/purchase-analysis.html
index 3f4d8a4..a79ca02 100644
--- a/system1-factory/web/pages/admin/purchase-analysis.html
+++ b/system1-factory/web/pages/admin/purchase-analysis.html
@@ -135,6 +135,7 @@
+