The user authentication may fail due to an incomplete SSO login process, expired user session, SDK initialization error, or if the browser has blocked third-party cookies.
The init
method returns an event emitter, which you can use to listen to AuthStatus
such as authentication failure, success, or user logout, and respond to these events with a message or corrective action.
authStatus = init(embedConfig); authStatus.on(AuthStatus.FAILURE, (reason) => {
console.log('Authentication failed');
});
Note
|
The EventEmitter returned from init is used only for listening to authentication status events such as AuthStatus.SUCCESS , AuthStatus.FAILURE , and AuthStatus.LOGOUT .
|
If you want to display a message in the embedded UI when a user login fails, include the loginFailedMessage
property in your init
call.
By default, the attribute displays the Not logged in
message in the embedded UI. To customize this message, define a string with custom text or markup as shown here:
loginFailedMessage: "Authentication failed! Please try again."
loginFailedMessage: "<div> <h3> Please enable third-party cookies</h3> <img src='<image url'> </div>"
You can also register event handlers to trigger the following events:
-
NoCookieAccess
Emitted if cookies are restricted by a userβs browser.
-
AuthExpire
Emitted if the SSO does not complete and if the ThoughtSpot session times out at some point.
-
AuthInit
Emitted when the authentication is completed.