Skip to main content

Logout

📋Prerequisites

There are two ways to log out from the SDK:

  1. Hard Logout (default): This option clears sessions from both the SDK (local) and the browser used for login. During the logout process, a browser is opened to clear the browser session.

    Once the browser session is cleared, the browser redirects to the logoutRedirectUri that was configured during Passport initialisation. If no logoutRedirectUri is specified, the SDK will default to using the logout redirect URI configured in the Immutable Hub client settings.

  2. Soft Logout: This option clears only the SDK's local session without affecting the browser session. No browser is opened during the process. To use soft logout, set the hardLogout parameter to false. However, keep in mind that with this option, gamers will remain logged in to Passport in the browser until their session expires.

await passport.Logout(/* hardLogout: true */);
💡Note
When performing a hard logout with Device Code Auth flow, it's recommended to have a dedicated logout page to redirect users to. See Passport Logout for more info.