Documentation Index
Fetch the complete documentation index at: https://cometchat-22654f5b-release-ios-chat-uikit-v5-1-2.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.
We 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 straightforward authentication method is ideal for proof-of-concept (POC) development or during the early stages of application development. For production environments, however, we strongly recommend using an AuthToken instead of an Auth Key to ensure enhanced security.- 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 advanced authentication procedure does not use the Auth Key directly in your client code thus ensuring safety.- 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