Skip to content

SSO on native Android apps

The Android integration loads Vuukle inside a WebView. Generate the SSO token on your backend (SSO overview), pass it down to the app, then inject it after Vuukle’s Comments initialized! console event fires.

private WebChromeClient webChromeClient = new WebChromeClient() {
@Override
public boolean onConsoleMessage(ConsoleMessage consoleMessage) {
if (consoleMessage.message().contains("Comments initialized!")) {
// Inject the SSO call once Vuukle's JS layer is ready.
mWebViewComments.loadUrl(
"javascript:vuukleLogin('" + ssoTokenFromYourBackend + "')"
);
}
return super.onConsoleMessage(consoleMessage);
}
};

Logging out

mWebViewComments.loadUrl("javascript:vuukleLogout()");
// Clear cookies for the Vuukle host afterwards.
android.webkit.CookieManager.getInstance().removeAllCookies(null);
Was this page helpful?
Help us improve — drop a note or open the dashboard.