removeAuthTokenProvider

Multicanle para Customer Service ofrece un conxunto de capacidades que amplían o poder de Dynamics 365 Customer Service Enterprise para permitir ás organizacións conectarse instantáneamente e interactuar cos seus clientes a través de canles como o chat en directo e SMS. Requírese unha licenza adicional para acceder á Multicanle para Customer Service. Para obter máis información, consulte as páxinas Visión xeral dos prezos de Dynamics 365 Customer Service e Plan de prezos de Dynamics 365 Customer Service .

Elimina o provedor de tokens de autenticación configurado actualmente, se é o caso.

Nota

Os métodos SDK de chat en directo deben ser invocados despois de que se levante o evento lcw:ready . Pode escoitar este evento engadindo o seu propio oínte de eventos no obxecto da xanela.

Este SDK só é aplicable se a autenticación está activada para o widget. Para activar a autenticación para o widget, consulte Crear configuración de autenticación de chat.

Sintaxe

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

Parámetros

Nada

Valor de devolución

Nada

Exemplo

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 da API JavaScript para o SDK de chat en directo