forked from baron/baron-sso
feat: SSO 로그인 리다이렉션 흐름 구현 (userfront & adminfront 연동) #243
This commit is contained in:
@@ -5,6 +5,21 @@ import 'dart:html' as html;
|
||||
import 'package:flutter/foundation.dart';
|
||||
|
||||
void implSendLoginSuccess(String token) {
|
||||
final uri = Uri.parse(html.window.location.href);
|
||||
final redirectUri = uri.queryParameters['redirect_uri'];
|
||||
|
||||
if (redirectUri != null && redirectUri.isNotEmpty) {
|
||||
// Redirection flow
|
||||
final target = Uri.parse(redirectUri);
|
||||
final query = Map<String, String>.from(target.queryParameters);
|
||||
query['token'] = token;
|
||||
final finalUri = target.replace(queryParameters: query);
|
||||
|
||||
debugPrint('Redirecting to: ${finalUri.toString()}');
|
||||
html.window.location.href = finalUri.toString();
|
||||
return;
|
||||
}
|
||||
|
||||
final message = {'type': 'LOGIN_SUCCESS', 'token': token};
|
||||
|
||||
if (html.window.opener != null) {
|
||||
|
||||
@@ -98,6 +98,13 @@ final _router = GoRouter(
|
||||
return LoginScreen(key: state.pageKey, loginChallenge: loginChallenge);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: '/ssologin',
|
||||
builder: (context, state) {
|
||||
_routerLogger.info("Navigating to /ssologin");
|
||||
return LoginScreen(key: state.pageKey);
|
||||
},
|
||||
),
|
||||
GoRoute(
|
||||
path: '/login',
|
||||
builder: (context, state) {
|
||||
|
||||
Reference in New Issue
Block a user