Live chat flashing non stop while calling JS Tawk_API.login

I am trying to use Tawk_API.login to fetch our client contact with Tawk_API.onload function. We can fetch it, but somehow the live chat is flashing non stop after a few seconds as the video linked. Our embeded script as follow:

<script type="text/javascript">
var Tawk_API=Tawk_API||{}, Tawk_LoadStart=new Date();
(function(){
var s1=document.createElement("script"),s0=document.getElementsByTagName("script")[0];
s1.async=true;
s1.src='LINK HERE';
s1.charset='UTF-8';
s1.setAttribute('crossorigin','*');
s0.parentNode.insertBefore(s1,s0);

Tawk_API.onLoad = function(){
	
	Tawk_API.login({
		  hash : 'hashed value',    // required
		  userId : 'Client ID',            // required
		  name : 'Client Name from database'
		}, function(error) {
		 // do something if error
		})


}
})()
</script>

Also when we add phone number to the login function, it is getting a bad request error.

Another question, we would like to know if the user data is not in our contact, will the api pass the information to create a new contact?
video as follow:

I got the same result when I used the login function in the onLoad function, but I tried to use the login function in the onBeforeLoad function. This seemed to help, but I still have some questions about restoring user conversations(

from the javascript api document, it says that This function will refresh and reconnect the session when called, so i assume each time it call its refreshing the live chat causing to flash, any one got clues on how to force the login not refresh?

I am now using a tricky way that on Maximize it login so it would refresh once, but its still have a strange feeling for the refresh