Hello @ashish,
Hello @ashish,
We are embedding TS using the token-based method, and if the token is invalid or not set, then the embedded screen displays the "Not logged in" text in the top right corner(see attached).
Can we customize the text and its style if the token is invalid or not set?
Below is the code, we are using to initialize TS and display contents.
async function initializeThoughtSpot() {
try {
init({
thoughtSpotHost: "",
authType: AuthType.TrustedAuthTokenCookieless,
getAuthToken: () => {
return 'token';
},
callPreFetch: true
});
login_ts();
} catch (error) {
console.error('Error occurred while initializing ThoughtSpot:', error);
}
}
function login_ts(){
const lb = new AppEmbed('#ts-embed', {
frameParams: {
height: '100vh',
},
pageId: Page.Pinboards,
});
lb.render();
hideNoDataImage();
showErrorBanner('none');
function setDisplayStyle(el, style) {
alert(el);
if(document.getElementById(el)) {
document.getElementById(el).style.display = style;
}
}
function showErrorBanner(display, errorText) {
setDisplayStyle("loader", "block");
if(errorText) {
document.getElementById("errorBanner").firstElementChild.innerText = errorText;
}else{
document.getElementById("errorBanner").firstElementChild.innerText = 'Hello';
}
}
}
window.addEventListener('load', function() {
initializeThoughtSpot();
});
Thanks,
CC: @Sandeep, @shikharTS
3 Replies
We have https://developers.thoughtspot.com/docs/Enumeration_EmbedEvent#_authexpire authExpire and authInit event for these. Would these help?
EmbedEvent
Event types emitted by the embedded ThoughtSpot application.
@Vikaschandra
yes you can configure that using https://developers.thoughtspot.com/docs/Interface_EmbedConfig#_loginfailedmessage
EmbedConfig
The configuration object for embedding ThoughtSpot content. It includes the ThoughtSpot hostname or IP address, the type of authentication, and the authentication endpoint if a trusted authentication server is used.
Thanks @shikharTS and @Justin Mathew , Now I am able to show a custom message.