fix: use sessionStorage instead of query param for logout flag
Logto does exact-match on post_logout_redirect_uri, so ?signed_out caused "not registered" error. Use sessionStorage flag instead — set before signOut, read and cleared on LoginPage mount. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -9,10 +9,11 @@ export function LoginPage() {
|
||||
const navigate = useNavigate();
|
||||
const redirected = useRef(false);
|
||||
|
||||
// Check if we arrived here from a logout redirect
|
||||
// Check if we arrived here from a logout redirect (set by useAuth before signOut)
|
||||
const [signedOut] = useState(() => {
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
return params.has('signed_out');
|
||||
const flag = sessionStorage.getItem('cameleer:signed_out');
|
||||
if (flag) sessionStorage.removeItem('cameleer:signed_out');
|
||||
return !!flag;
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
|
||||
@@ -7,7 +7,8 @@ export function useAuth() {
|
||||
const { currentTenantId } = useOrgStore();
|
||||
|
||||
const logout = useCallback(() => {
|
||||
signOut(window.location.origin + '/platform/login?signed_out');
|
||||
sessionStorage.setItem('cameleer:signed_out', '1');
|
||||
signOut(window.location.origin + '/platform/login');
|
||||
}, [signOut]);
|
||||
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user