After logout, redirect to /platform/login?signed_out which shows a "Signed out" card with a "Sign in again" button instead of immediately redirecting back to Logto OIDC (which would auto-authenticate if the Logto session cookie persists). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
21 lines
504 B
TypeScript
21 lines
504 B
TypeScript
import { useLogto } from '@logto/react';
|
|
import { useCallback } from 'react';
|
|
import { useOrgStore } from './useOrganization';
|
|
|
|
export function useAuth() {
|
|
const { isAuthenticated, isLoading, signOut, signIn } = useLogto();
|
|
const { currentTenantId } = useOrgStore();
|
|
|
|
const logout = useCallback(() => {
|
|
signOut(window.location.origin + '/platform/login?signed_out');
|
|
}, [signOut]);
|
|
|
|
return {
|
|
isAuthenticated,
|
|
isLoading,
|
|
tenantId: currentTenantId,
|
|
logout,
|
|
signIn,
|
|
};
|
|
}
|