refactor: replace hand-rolled OIDC with @logto/react SDK
The hand-rolled OIDC flow (manual PKCE, token exchange, URL construction) was fragile and accumulated multiple bugs. Replaced with the official @logto/react SDK which handles PKCE, token exchange, storage, and refresh automatically. - Add @logto/react SDK dependency - Add LogtoProvider with runtime config in main.tsx - Add TokenSync component bridging SDK tokens to API client - Add useAuth hook replacing Zustand auth store - Simplify LoginPage to signIn(), CallbackPage to useHandleSignInCallback() - Delete pkce.ts and auth-store.ts (replaced by SDK) - Fix react-router-dom → react-router imports in page files - All 17 React Query hooks unchanged (token provider pattern) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useAuthStore } from '../auth/auth-store';
|
||||
import { useAuth } from '../auth/useAuth';
|
||||
|
||||
const ROLE_PERMISSIONS: Record<string, string[]> = {
|
||||
OWNER: ['tenant:manage', 'billing:manage', 'team:manage', 'apps:manage', 'apps:deploy', 'secrets:manage', 'observe:read', 'observe:debug', 'settings:manage'],
|
||||
@@ -8,7 +8,7 @@ const ROLE_PERMISSIONS: Record<string, string[]> = {
|
||||
};
|
||||
|
||||
export function usePermissions() {
|
||||
const roles = useAuthStore((s) => s.roles);
|
||||
const { roles } = useAuth();
|
||||
|
||||
const permissions = new Set<string>();
|
||||
for (const role of roles) {
|
||||
|
||||
Reference in New Issue
Block a user