Function logoutSilent

  • Logout silently using a hidden iframe. Clears the session on the auth server without redirecting the current page.

    Note: Silent logout may not work in all browsers due to third-party cookie restrictions. For more reliable session cleanup, use logoutWithRedirect.

    Parameters

    • config: LogoutConfig

      Logout configuration

    • Optionaltimeout: number

      Timeout in milliseconds (default: 5000)

    Returns Promise<void>

    Promise that resolves when logout is complete or times out

    import { logoutSilent } from '@imtbl/auth';

    try {
    await logoutSilent({
    clientId: 'your-client-id',
    });
    console.log('Logged out silently');
    } catch (error) {
    console.error('Silent logout failed:', error);
    // Fall back to redirect logout
    }