logout

Log the user out of Venly.

This function will log the user out of Venly.

// Log out and redirect to the current page
venlyConnect.logout({ windowMode: 'REDIRECT' });

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:

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

Returns:

Promise<void>

Parameters:

ParameterTypeRequiredDescription
optionsAuthenticationOptionsFalseProvide extra options on who to logout

Examples:

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

Object Types

📘