...
Supporting customers is even faster and more seamless with the auto-login integration. With this feature, once a customer logs in to your website or portal, they will automatically be logged in to the Chat Widget without having to enter separate credentials. This makes the customer's experience seamless and removes a potential blocker to them getting in touch with you. It also enables agents to respond more quickly.
...
The service’s front end should receive this token and call Chat’s SSO login API:
Code Block |
---|
const chatWidget = document.querySelector('chat-widget');
chatWidget.onload = function () {
await chatWidget.loginWithToken(token);
}; |
Expand | |||||
---|---|---|---|---|---|
| |||||
|
In order to make it work, we need to make sure that Chat has been correctly initialized before the login operation. To do this, we can use initCallback
from the spartezSupportChat
object – see Set Up Chat Widget on Your Website.If you don’t want to show Chat Widget to users until they log in, you can add the following call to the code above:
Code Block |
---|
chatWidget.show(); |
During the login operation, an error may occur. In that case, an exception will be thrown. To get the error description, you can access exception.message
property.
...
To log out, the service’s front end should call await chatWidget.logout();
.
Expand | ||
---|---|---|
| ||
|
...