Compartir a través de


removeAuthTokenProvider

La Plataforma omnicanal para Customer Service ofrece un conjunto de funciones que extienden la potencia de Dynamics 365 Customer Service Enterprise con el que las organizaciones pueden conectarse e interactuar de forma instantánea con sus clientes en distintos canales de mensajería digital. Se necesitan una licencia adicional para acceder a la Plataforma omnicanal para Customer Service. Para más información, consulte las páginas Descripción general de precios de Dynamics 365 Customer Service y Plan de precios de Dynamics 365 Customer Service.

Quita el proveedor de token de autenticación establecido actualmente, si lo hay.

Nota:

Los métodos del SDK de chat en vivo deben invocarse después de que se genere el evento lcw:ready . Puede escuchar este evento agregando su propio detector de eventos en el objeto window.

Este SDK solo se aplica si la autenticación está habilitada para el widget. Para habilitar la autenticación para el widget, consulte Crear ajustes de autenticación de chat.

Syntax

Microsoft.Omnichannel.LiveChatWidget.SDK.removeAuthTokenProvider();

Parámetros

Ninguno

Valor devuelto

Ninguno

Example

let payloadToEncrypt = {
    "sub" : "87b4d06c-abc2-e811-a9b0-000d3a10e09e",
    "lwicontexts" :"{\"msdyn_cartvalue\":\"10000\", \"msdyn_isvip\":\"false\"}",
    "iat" : 1542622071,
    "iss" : "contosohelp.com",
    "exp" : 1542625672,
    "nbf" : 1542622072
};

function convertToJwtToken(payloadToEncrypt){
    // Ideally, you call your service to convert the payload to a valid JSON Web Token
    return Promise.resolve("eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI4N2I0ZDA2Yy1hYmMyLWU4MTEtYTliMC0wMDBkM2ExMGUwOWUiLCJsd2ljb250ZXh0cyI6IntcIm1zZHluX2NhcnR2YWx1ZVwiOlwiMTAwMDBcIiwgXCJtc2R5bl9pc3ZpcFwiOlwiZmFsc2VcIn0iLCJpYXQiOjE1NDI2MjIwNzEsImlzcyI6ImNvbnRvc29oZWxwLmNvbSIsImV4cCI6MTU0MjYyNTY3MiwibmJmIjoxNTQyNjIyMDcyfQ.r37z1M5rMyRYMOJ-rhyTRYFOgvl9N7KvTMueSFPkiuM");
}

window.addEventListener("lcw:ready", function handleLivechatReadyEvent(){
// Sets the auth-token provider
// Throws error if authTokenProvider is not a function
    convertToJwtToken(payloadToEncrypt).then(function (jwtToken){
        Microsoft.Omnichannel.LiveChatWidget.SDK.setAuthTokenProvider(function authTokenProvider(callback){
            callback(jwtToken);
        });

        // Removes the currently set authentication token provider
        Microsoft.Omnichannel.LiveChatWidget.SDK.removeAuthTokenProvider();
    });
});

Referencia de la API de JavaScript para el SDK de chat en vivo