How do I add basic security to my CometChat installation? (web)

If your CometChat HTML code does not contain chat_auth variable, it is possible that the Basic Security features of CometChat are not enabled.

Before you begin, Sign in to your CometChat Client Area and click on the Manage button and then note down the Auth Key present in API Keys (top right button).

Then perform these steps to enable Basic Security

Add chat_auth variable to your HTML code

Just after the line which contains chat_appid, add the chat_auth code:

var chat_appid = 'APP_ID';
// Add the following line
var chat_auth = 'AUTH_KEY';
// Leave the remaining code below as it is

Replace AUTH_KEY in the above code with your actual Auth Key.

Once you’ve added the Auth Key, visit the CometChat Admin Panel and head over to Settings -> Authentication. Under Security, enable the “Enable Auth Key Verification?” setting.

Clear your browser cache and visit your website.

We strongly recommend switching off Guest chat feature in CometChat Admin Panel.