Anonymous Chat (Guest Mode)
- Let anyone chat anonymously without signing up or logging in.
- Perfect for marketing pages, help centers, or demo sites.
Create + Log In User On The Fly
- Use your existing user IDs (email, username etc.) to create and log in users automatically.
- No backend needed—CometChat creates users the first time they visit.
Backend-Created User (Auth Token Login)
- Create your users via server and login them using secure auth token on frontend.
- Ideal for sites with existing login systems and backends.
1. Anonymous Chat (Guest Mode)
Use this when:- Anyone should be able to start chatting instantly
- You do not have (or do not want) your own login form yet
Copy this into <head>
Copy this into <body>
Update these values
2. Create + Log In User On The Fly
Use this when:- Every person already has an ID inside your product (email, username etc.)
- You want that ID to drive their chat identity automatically
Copy this into <head>
Copy this into <body>
Update these values
3. Backend-Created User (Auth Token Login)
Use this when:- People sign in through your backend, and you generate their CometChat auth token server-side.
- Authenticate the user in your app.
- If it’s their first time, call Create User (https://www.cometchat.com/docs/rest-api/users/create) — you can also request an auth token in that call.
- For returning users, call Create Auth Token (https://www.cometchat.com/docs/rest-api/auth-tokens/create) to issue a fresh token.
- Send the token to the browser and place it in the widget config below.
- The same token works for the CometChat Widget, UI Kit, or SDK.