Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-docs-android-v6-beta2.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Create User
Before you login the user, you must add the user to CometChat.- For proof of concept/MVPs: Create the user using the CometChat Dashboard.
- For production apps: Use the CometChat Create User API to create the user when your user signs up in your app.
Sample UsersWe have setup 5 users for testing having UIDs:
cometchat-uid-1, cometchat-uid-2, cometchat-uid-3, cometchat-uid-4 and cometchat-uid-5.login() method.
We recommend you call the CometChat login() method once your user logs into your app. The login() method needs to be called only once.
Login using Auth Key
This simple authentication procedure is useful when you are in development.- Dart
| Parameter | Description |
|---|---|
| UID | The UID of the user that you would like to login |
| authKey | CometChat App Auth Key |
User object.
Login using Auth Token
This authentication procedure does not use the API Key directly in your client code ensuring that your API Key is not leaked even if the client code is reverse engineered.- Create a User via the CometChat API when the user signs up in your app.
- Create an Auth Token via the CometChat API for the new user every time the user logs in to your app.
- Pass the Auth Token to your client and use it in the
login()method.
- Dart
| Parameter | Description |
|---|---|
| authToken | |
| Auth Token of the user you would like to login |
User object.
Logout
You can use thelogout() method to log out the user from CometChat. We suggest you call this method once your user has been successfully logged out from your app.
- Dart