Sign-In Touchpoint Events
- Applies to:
- MindTouch (current)
- Role required:
- Admin
Events
mindtouch-web-widget:login:ready
Fired when the login widget is created. The event data contains the following properties:
Name | Type |
---|---|
embedId | string |
document.addEventListener('mindtouch-web-widget:login:ready', ({ data }) => { const embedId = data.embedId; });
mindtouch-web-widget:login:loaded
Fired when the login widget is loaded. The event data contains the following properties:
Name | Type |
---|---|
embedId | string |
widget.authProviderId | string |
widget.silentLoginExperienceEnabled | bool |
user | object |
document.addEventListener('mindtouch-web-widget:login:loaded', ({ data }) => { const embedId = data.embedId; const user = data.user; // programmable widget interface contains properties and functions const widget = data.widget; });
mindtouch-web-widget:login:auth-changed
Fired when the login widget detects that the request user's authentication state has changed. The event data contains the following properties:
Name | Type |
---|---|
embedId | string |
user | object |
document.addEventListener('mindtouch-web-widget:login:auth-changed', ({ data }) => { const embedId = data.embedId; const user = data.user; });
Properties
authProviderId
authProviderId : string
Retrieve or set the authentication provider id and update the sign-in link @href
. Set as a JavaScript object property or as adata-auth-provider-id
data attribute on the mindtouch/embed
script HTML element.
document.addEventListener('mindtouch-web-widget:login:loaded', ({ data }) => { const widget = data.widget; // use the mindtouch site auth provider with id widget.authProviderId = '{example-auth-provider-id}'; // use the default mindtouch site auth provider with "default" widget.authProviderId = 'default'; // or null... widget.authProviderId = null; // get the authentication provider id const foo = widget.authProviderId; });
<script async="async" src="https://success.mindtouch.com/@embed/{guid}.js"></script> <script type="mindtouch/embed" id="mindtouch-embed-{guid}" data-auth-provider-id="{example-auth-provider-id}"></script>
embedId
embedId : string
The id of the widget that uniquely identifies it.
silentLoginExperienceEnabled
silentLoginExperienceEnabled : bool
Retrieve or set the silent authentication setting. Set as a JavaScript object property or as adata-silent-login-experienced-enabled
data attribute on the mindtouch/embed
script HTML element.
document.addEventListener('mindtouch-web-widget:login:loaded', ({ data }) => { const widget = data.widget; const isSilentAuthenticationEnabled = widget.silentLoginExperienceEnabled; // disable silent authentication widget.silentLoginExperienceEnabled = false; // enable silent authentication widget.silentLoginExperienceEnabled = true; });
<script async="async" src="https://success.mindtouch.com/@embed/{guid}.js"></script> <script type="mindtouch/embed" id="mindtouch-embed-{guid}" data-silent-login-experience-enabled="{boolean}"></script>
user
user : object
An object that contains information about the current Expert session user (or anonymous information if there is no authenticated session).
document.addEventListener('mindtouch-web-widget:login:loaded', ({ data }) => { if(!data.user.anonymous) { // user is signed in } });