logout
Log the user out of Venly
This function will log the user out of Venly.
1
// Log out and redirect to the current page
2
venlyConnect.logout({ windowMode: 'REDIRECT' });
Copied!
The behavior is different depending on the windowMode used to instantiate VenlyConnect or provided in the options.
  • POPUP (default): The user will be logged out in the background and the promise will resolve when finished. This means the application needs to clean up all user data on screen itself.
  • REDIRECT: The user will be redirected to the logout endpoint of our Venly authentication provider. Followed by a redirect back to the page the user was on. The page can be altered by using the option redirectUri . The page refreshes automatically, no cleanup is necessary.
If you set the redirectUri option, make sure that the SDK and the AuthenticationResult handling is also present on the page you redirect to.

Signature

1
venlyConnect.logout(options?: AuthentciationOptions): Promise<void>
Copied!

Returns

1
Promise<void>
Copied!

Parameters

Parameter
Type
Required
Description
options
False
Provide extra options on who to logout

Examples

1
// Example 1
2
// Log out, then cleanup user data on screen
3
venlyConnect.logout({ windowMode: 'POPUP' })
4
.then(() => {
5
// Cleanup user data on screen
6
handleLogout();
7
});
Copied!
1
// Example 2
2
// Log out and redirect to https://foo.io
3
venlyConnect.logout({ windowMode: 'REDIRECT' , redirectUri: 'https://foo.io'});
Copied!

Object Types

Last modified 2mo ago