Hi, I have an SPA and so have to log users in asychronously. For some reason I keep getting UNAUTHORIZED_API_CALL messages. Here is my flow

  1. On page load, javascript is embedded
  2. On User login setAttributes is called (See Example 1 below) (At this point I receive the UNAUTHORIZED_API_CALL error)
  3. When a user is logged out, logout() is called
  4. When a new user is logged in, setAttributes is called again

Example 1 - User login

        'userId': currentUser.Id,
        'name': currentUser.Name,
        'email': currentUser.Email,
        'hash': hash
    (error) => {
        console.error("set attribute error", error);

Example 2: Hash creation

    var tawkApiKey = "xxxxx";

    using (var hmac = new HMACSHA256(Encoding.UTF8.GetBytes(tawkApiKey)))
        byte[] hashBytes = hmac.ComputeHash(Encoding.UTF8.GetBytes(user.Id.ToString()));
        return this.Ok(BitConverter.ToString(hashBytes).Replace("-", "").ToLower());
1 Like

Same issue here. I created an issue in the git repo: Confusing documentation, setAttributes not working · Issue #28 · tawk/tawk-messenger-react · GitHub

any solution to this yet?