Skip to content

isauro-am/Tawk.to-CSRF-error

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

Tawk.to-CSRF-error

What is Tawk.to

tawk.to is a live chat software designed to help businesses communicate with clients and website visitors to deliver customer support. Key features include canned responses, offline forms, website visitor tracking, customizable branding, file sharing, screen sharing and chat history.

In a deployment, when integrating the tawk.to chat by API, it started to generate a conflict in the handling of sessions, this when working on other sections where the Tawk.to chat was not actually active.

A quick alternative to avoid the CSRF error was cleaning the cookies generated by tawk.to

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

<script type="text/javascript">
    $( document ).ready( clean_cookies()  );

    function clean_cookies(){
        var cookies = document.cookie.split(';');

        for(var i = 1; i <= cookies.length; i++) {
            var current = cookies[i-1].split("=");
            if( current[0].includes("TawkConnectionTime") ||
                current[0].includes("twk_uuid") ||
                current[0].includes("twk_idm_key") ){
                    var name = String(current[0]);
                    if(name[0] === ' '){
                            name = name.substring(1);
                    }
                    document.cookie = name + '=;' +
                            'expires=Thu, 01-Jan-1970 00:00:01 GMT;' +
                            'path=' + '/;' +
                            'domain=' + window.location.host + ';' +
                            'secure=;';
            }
        };
    }
</script>

Another CSRF error reference in tawk.to

https://github.com/Javaabu/wiki/wiki/Adding-Tawk.to-widget-causes-CORS-error-(making-external-ajax-request-causing-CORS-error)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published