1
0
forked from baron/baron-sso

fix: SSO 로그인 성공 시 adminfront로의 리다이렉션 및 postMessage 흐름 강화 #243

This commit is contained in:
2026-02-11 15:50:13 +09:00
parent 50209a1506
commit 516a7b3635
2 changed files with 21 additions and 12 deletions

View File

@@ -3,8 +3,14 @@
import 'dart:async';
import 'dart:html' as html;
import 'package:flutter/foundation.dart';
import 'auth_token_store.dart';
void implSendLoginSuccess(String token) {
var effectiveToken = token;
if (effectiveToken.isEmpty) {
effectiveToken = AuthTokenStore.getToken() ?? "";
}
final uri = Uri.parse(html.window.location.href);
final redirectUri = uri.queryParameters['redirect_uri'];
@@ -12,7 +18,7 @@ void implSendLoginSuccess(String token) {
// Redirection flow
final target = Uri.parse(redirectUri);
final query = Map<String, String>.from(target.queryParameters);
query['token'] = token;
query['token'] = effectiveToken;
final finalUri = target.replace(queryParameters: query);
debugPrint('Redirecting to: ${finalUri.toString()}');
@@ -20,7 +26,7 @@ void implSendLoginSuccess(String token) {
return;
}
final message = {'type': 'LOGIN_SUCCESS', 'token': token};
final message = {'type': 'LOGIN_SUCCESS', 'token': effectiveToken};
if (html.window.opener != null) {
try {