1
0
forked from baron/baron-sso

로그인 콜백-가드 흐름 및 API 인증 처리 안정화

This commit is contained in:
2026-03-03 14:11:54 +09:00
parent 7c1dbaf206
commit 7cf07a5627
5 changed files with 20 additions and 8 deletions

View File

@@ -10,7 +10,9 @@ export default function AuthCallbackPage() {
useEffect(() => {
// 팝업으로 열린 경우 signinPopupCallback 처리
if (window.opener) {
userManager.signinPopupCallback();
userManager.signinPopupCallback().catch((error) => {
console.error("Popup callback failed:", error);
});
return;
}

View File

@@ -4,7 +4,7 @@ import { Navigate, Outlet } from "react-router-dom";
export default function AuthGuard() {
const auth = useAuth();
if (auth.isLoading) {
if (auth.isLoading || auth.activeNavigator) {
return <div>Loading...</div>;
}

View File

@@ -1,4 +1,5 @@
import { ExternalLink, LogIn, ShieldHalf } from "lucide-react";
import { useEffect } from "react";
import { useAuth } from "react-oidc-context";
import { useNavigate } from "react-router-dom";
import { Button } from "../../components/ui/button";
@@ -14,10 +15,15 @@ function LoginPage() {
const auth = useAuth();
const navigate = useNavigate();
useEffect(() => {
if (auth.isAuthenticated) {
navigate("/clients", { replace: true });
}
}, [auth.isAuthenticated, navigate]);
const handleSSOLogin = async () => {
try {
await auth.signinPopup();
navigate("/clients", { replace: true });
} catch (error) {
console.error("Popup login failed", error);
}