Skip to main content

# subscribeToSessionExpiry()

    function subscribeToSessionExpiry(onSessionExpiry: LISTENER): (...args: []) => void;

Subscribes to session expiry events. The callback is invoked when the session has expired.

## Parameters​

### onSessionExpiry​

`LISTENER`

Callback function invoked on session expiry

## Returns​

Unsubscribe function to remove the listener

    (...args: []): void;

### Parameters​

#### args​

...[]

### Returns​

`void`

## Example​

    const unsubscribe = subscribeToSessionExpiry(() => {
      console.log('Session expired');
      window.location.href = '/login';
    });