From 2d928ab1e30f90d0d5b8b466f04b7c6e87ba1a5c Mon Sep 17 00:00:00 2001 From: kyuuseiryuu Date: Mon, 16 Mar 2026 14:30:23 +0900 Subject: [PATCH] feat: configure Logto scopes and externalize appId - Add 'admin' scope to Logto configuration in frontend.tsx. - Externalize Logto appId to common.ts utils for better configuration management. - Remove `isAuthExpired` check in UserCenter.tsx and always show the "Re-login" button. --- src/frontend.tsx | 7 +++++-- src/page/UserCenter.tsx | 14 ++++++-------- src/utils/common.ts | 1 + 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/frontend.tsx b/src/frontend.tsx index db83ea6..f1e0a0f 100644 --- a/src/frontend.tsx +++ b/src/frontend.tsx @@ -13,14 +13,17 @@ import { RouterProvider } from "react-router"; import { LogtoProvider, type LogtoConfig } from '@logto/react'; import { route } from "./routes"; import { LOGTO_RESOURCE } from "./utils/constants"; -import { LOGTO_DOMAIN } from "./utils/common"; +import { LOGTO_APPID, LOGTO_DOMAIN } from "./utils/common"; const elem = document.getElementById("root")!; const config: LogtoConfig = { endpoint: LOGTO_DOMAIN, - appId: 'iq0oceaeqazpcned7hzil', + appId: LOGTO_APPID, resources: [LOGTO_RESOURCE], + scopes: [ + 'admin', + ] }; const app = ( diff --git a/src/page/UserCenter.tsx b/src/page/UserCenter.tsx index b15c51e..c67924e 100644 --- a/src/page/UserCenter.tsx +++ b/src/page/UserCenter.tsx @@ -20,7 +20,7 @@ const redirect = encodeURIComponent(USER_CENTER_URL); export const UserCenter = () => { const { signIn, isAuthenticated, signOut, getIdTokenClaims } = useLogto(); - const { isAuthExpired, autoSignIn } = useAutoLogin(); + const { autoSignIn } = useAutoLogin(); const [user, setUser] = useState(); const navigate = useNavigate(); const location = useLocation(); @@ -75,13 +75,11 @@ export const UserCenter = () => { - {isAuthExpired && ( - - - - )} + + +