forked from baron/baron-sso
fix: SSO 로그인 성공 시 adminfront로의 리다이렉션 및 postMessage 흐름 강화 #243
This commit is contained in:
@@ -163,6 +163,16 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
final token = AuthTokenStore.getToken();
|
||||
if (token != null && token.isNotEmpty) {
|
||||
if (WebAuthIntegration.isPopup() || (_redirectUrl != null && _redirectUrl!.isNotEmpty)) {
|
||||
debugPrint("[Auth] Cookie session with external integration. Notifying...");
|
||||
WebAuthIntegration.sendLoginSuccess(token);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (mounted) {
|
||||
context.go('/');
|
||||
}
|
||||
@@ -1123,17 +1133,10 @@ class _LoginScreenState extends ConsumerState<LoginScreen>
|
||||
}
|
||||
}
|
||||
|
||||
if (WebAuthIntegration.isPopup()) {
|
||||
debugPrint("[Auth] Popup detected. Notifying opener and attempting to close.");
|
||||
if (WebAuthIntegration.isPopup() || (_redirectUrl != null && _redirectUrl!.isNotEmpty)) {
|
||||
debugPrint("[Auth] External integration detected (popup or redirect). Notifying...");
|
||||
WebAuthIntegration.sendLoginSuccess(token);
|
||||
return; // Stop here for popups
|
||||
}
|
||||
|
||||
if (_redirectUrl != null && _redirectUrl!.isNotEmpty) {
|
||||
debugPrint("[Auth] Redirecting standalone window to: $_redirectUrl");
|
||||
final target = "$_redirectUrl?token=$token";
|
||||
launchUrlString(target, webOnlyWindowName: '_self');
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
debugPrint("[Auth] Login success. Navigating to root.");
|
||||
|
||||
Reference in New Issue
Block a user