fix(logto): adicionar PKCE + rota /callback

- Logto EXIGE PKCE, sem isso retorna 400 invalid_request
- client.ts: restaura generatePkce() com crypto.subtle
- Adiciona /callback route + Callback.tsx que processa ?code=
- useAuth expõe handleCallback() no contexto
- nginx já tem fallback SPA, então /callback carrega index.html
  e React Router mostra a página de Callback
This commit is contained in:
2026-08-18 10:23:29 +00:00
parent a3c76c17b4
commit 0ce317a8f3
4 changed files with 195 additions and 34 deletions
+6
View File
@@ -28,6 +28,7 @@ export interface UseAuthReturn {
signUp: (email: string, password: string) => Promise<{ error: unknown }>;
signOut: () => Promise<void>;
updatePassword: (password: string) => Promise<{ error: unknown }>;
handleCallback: () => Promise<boolean>;
}
const AuthContext = createContext<UseAuthReturn | undefined>(undefined);
@@ -92,6 +93,10 @@ export function AuthProvider({ children }: { children: ReactNode }) {
};
}, []);
const handleCallbackFn = useCallback(async (): Promise<boolean> => {
return await handleCallback();
}, []);
const value: UseAuthReturn = {
user,
loading,
@@ -101,6 +106,7 @@ export function AuthProvider({ children }: { children: ReactNode }) {
signUp,
signOut,
updatePassword,
handleCallback: handleCallbackFn,
};
return <AuthContext.Provider value={value}>{children}</AuthContext.Provider>;