1
0
forked from baron/baron-sso

세션정보 누락 해결.

This commit is contained in:
Lectom C Han
2026-01-30 16:49:39 +09:00
parent 1db7ce8f10
commit b39789dbe2
9 changed files with 92 additions and 206 deletions

View File

@@ -2,7 +2,6 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_dotenv/flutter_dotenv.dart';
import 'package:descope/descope.dart';
import 'package:go_router/go_router.dart';
import 'package:flutter/services.dart';
import 'package:flutter_web_plugins/url_strategy.dart';
@@ -66,21 +65,6 @@ void main() async {
// 폰트를 먼저 로딩해서 렌더링 깨짐(FOIT/FOUT) 최소화
await _loadBundledFonts();
// Initialize Descope (프로젝트 ID가 없으면 경고만 남기고 진행)
final projectId = dotenv.maybeGet('DESCOPE_PROJECT_ID') ?? '';
if (projectId.isEmpty || projectId == 'your-project-id') {
_log.severe("DESCOPE_PROJECT_ID is missing. Descope may not work correctly.");
}
Descope.setup(projectId);
// Load saved session if any
try {
// 저장된 세션 불러옴
await Descope.sessionManager.loadSession();
} catch (e) {
_log.warning("Failed to load session: $e");
}
runApp(const ProviderScope(child: BaronSSOApp()));
}
@@ -189,11 +173,9 @@ final _router = GoRouter(
),
],
redirect: (context, state) {
final hasDescopeSession =
Descope.sessionManager.session?.refreshToken?.isExpired == false;
final hasStoredToken = AuthTokenStore.getToken() != null;
final hasCookieSession = AuthTokenStore.usesCookie();
final isLoggedIn = hasDescopeSession || hasStoredToken || hasCookieSession;
final isLoggedIn = hasStoredToken || hasCookieSession;
final path = state.uri.path;
// Public paths that don't require login