Read our documentation
For more in-depth guides on onboarding and setup.
Read Documentation

nativeFunctions.logout()

If your app is configured to require users to login before they can access the content, and you are already using the nativeFunctions.login() to log users in, you will want to implement the nativeFunctions.logout() function as well.

When triggered, the nativeFunctions.logout() will clear all cookies and sessions in the app, and reload the app, taking the user back to the login screen.

Imagine a situation where while browsing your app the user gets logged out because his cookies expired, if the nativeFunctions.logout() function is not triggered the user will see your website's error messages for blocked content, and the user experience might get confusing for the user.

Instead, you should take the user to the login screen so he can provide his credentials and re-login accordingly.

You can call the nativeFunctions.logout() after you have confirmed that the user is not logged-in:

// Check if the user is currently logged-in, if not, call the logout function

<script type="text/javascript">
// Add the event listener
window.addEventListener("message", (event) => {
isAppReady = event;
}, false);

// Log the user in
function appLogout(isAppReady) {
try {
// Check if the native functions are ready to be used
if (isAppReady.data && isAppReady.data == 'nativeFunctionsLoaded') {
nativeFunctions.logout();
}

} catch (ex) {
console.log(ex.message);
}
}
</script>

Thank you! We'll be in touch within 48 hours :)
Oops! Something went wrong while submitting the form.
Preview My App
Preview My App