Login api returns error 400 Bad Request

I am using Javascript Api login method and getting the error 400 , below is my code -

window.Tawk_API.login({
    hash : 'hashcode',    // required
    userId : '1234',            // required
    name : 'My Name',
    email : 'test@gmail.com',
  }, function(error) {
  });

Response :
{“ok”:false,“error”:{“code”:“BadRequestError”,“message”:“”}}

Generating hash in PHP
hash_hmac(‘sha256’, $user_id.$tawk_api_key, $as_binary=true);

Any help would be appreciated!