Terminates the currently active WalletTwo user session and notifies the host page. Use this action when your application needs to trigger a WalletTwo sign-out as part of your own sign-out flow — for example, when the user logs out of your platform and you want to clean up the embedded wallet session at the same time.
On mount, logout() is called immediately (no user confirmation prompt).
Regardless of whether logout succeeds or fails, window.parent.postMessage(...) is fired.
If redirect_uri is present, the iframe navigates to that URL.
While waiting, a centered loading spinner is shown.
The logout always completes silently from the user's perspective. Errors are logged to the browser console only.
postMessage event
Fired to window.parent after the logout attempt finishes (whether it succeeded or failed):
Field
Description
event
Always "wallet_logout"
type
Always "wallet_logout" (legacy alias, same value)
There is no success/failure distinction in the event. If your application needs to confirm the logout actually succeeded, use the redirect_uri path together with a server-side session check.
redirect_uri callback
The iframe navigates to redirect_uri with no additional query params appended:
Host page integration
Option A: postMessage only
Option B: redirect_uri
If you prefer not to use postMessage, pass a redirect_uri to your own page and handle the arrival there:
When the iframe lands on https://example.com/logout-complete, your server can clear the session cookie and redirect the top-level page as needed.
Triggering logout programmatically from the parent page
You can create the logout iframe dynamically when a user signs out of your platform, without keeping it in the DOM at all times:
Notes
The action logs out the user immediately on mount without any confirmation step. Do not navigate to this route unless you intend to end the session.
Logout errors are swallowed silently in the UI. Even if the server-side logout call fails, the wallet_logout event is still fired.
After logout, if the user navigates to any /action/* or /wallet/* route, they will be redirected to /auth/login by LoggedMiddleware.