@cometchat/skills 4.2.1 → 4.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +33 -12
- package/bin/install.js +59 -4
- package/package.json +14 -1
- package/skills/cometchat/SKILL.md +460 -77
- package/skills/cometchat/references/asking-questions.md +48 -0
- package/skills/cometchat-a11y/SKILL.md +3 -2
- package/skills/cometchat-android-v5/SKILL.md +2 -1
- package/skills/cometchat-android-v5-calls/SKILL.md +36 -22
- package/skills/cometchat-android-v5-calls/references/README.md +1 -1
- package/skills/cometchat-android-v5-calls/references/add-calls-to-existing-chat.md +7 -5
- package/skills/cometchat-android-v5-calls/references/audio-controls.md +4 -4
- package/skills/cometchat-android-v5-calls/references/call-layouts.md +33 -25
- package/skills/cometchat-android-v5-calls/references/call-session.md +2 -2
- package/skills/cometchat-android-v5-calls/references/custom-ui.md +5 -5
- package/skills/cometchat-android-v5-calls/references/event-listeners.md +2 -2
- package/skills/cometchat-android-v5-calls/references/idle-timeout.md +20 -14
- package/skills/cometchat-android-v5-calls/references/in-call-chat.md +1 -1
- package/skills/cometchat-android-v5-calls/references/migration-v4-to-v5.md +43 -27
- package/skills/cometchat-android-v5-calls/references/participant-management.md +3 -3
- package/skills/cometchat-android-v5-calls/references/raise-hand.md +25 -19
- package/skills/cometchat-android-v5-calls/references/recording.md +2 -2
- package/skills/cometchat-android-v5-calls/references/ringing-integration.md +1 -1
- package/skills/cometchat-android-v5-calls/references/screen-sharing.md +5 -9
- package/skills/cometchat-android-v5-calls/references/session-settings.md +3 -3
- package/skills/cometchat-android-v5-calls/references/setup.md +1 -1
- package/skills/cometchat-android-v5-calls/references/share-invite.md +9 -4
- package/skills/cometchat-android-v5-calls/references/video-controls.md +4 -4
- package/skills/cometchat-android-v5-calls/references/voip-calling.md +2 -2
- package/skills/cometchat-android-v5-components/SKILL.md +4 -3
- package/skills/cometchat-android-v5-core/SKILL.md +20 -2
- package/skills/cometchat-android-v5-customization/SKILL.md +171 -7
- package/skills/cometchat-android-v5-extensions/SKILL.md +7 -4
- package/skills/cometchat-android-v5-features/SKILL.md +5 -4
- package/skills/cometchat-android-v5-placement/SKILL.md +2 -1
- package/skills/cometchat-android-v5-production/SKILL.md +2 -1
- package/skills/cometchat-android-v5-push/SKILL.md +2 -3
- package/skills/cometchat-android-v5-testing/SKILL.md +2 -1
- package/skills/cometchat-android-v5-theming/SKILL.md +2 -1
- package/skills/cometchat-android-v5-troubleshooting/SKILL.md +3 -2
- package/skills/cometchat-android-v6/SKILL.md +2 -1
- package/skills/cometchat-android-v6-builder-settings/SKILL.md +11 -7
- package/skills/cometchat-android-v6-calls/SKILL.md +79 -18
- package/skills/cometchat-android-v6-calls/references/advanced-features.md +87 -0
- package/skills/cometchat-android-v6-calls/references/call-layouts.md +24 -15
- package/skills/cometchat-android-v6-calls/references/call-session.md +2 -2
- package/skills/cometchat-android-v6-calls/references/device-management.md +17 -16
- package/skills/cometchat-android-v6-calls/references/idle-timeout.md +7 -4
- package/skills/cometchat-android-v6-calls/references/in-call-chat.md +13 -8
- package/skills/cometchat-android-v6-calls/references/raise-hand.md +6 -4
- package/skills/cometchat-android-v6-compose-components/SKILL.md +52 -29
- package/skills/cometchat-android-v6-compose-customization/SKILL.md +156 -1
- package/skills/cometchat-android-v6-compose-placement/SKILL.md +129 -40
- package/skills/cometchat-android-v6-compose-theming/SKILL.md +27 -1
- package/skills/cometchat-android-v6-core/SKILL.md +389 -9
- package/skills/cometchat-android-v6-events/SKILL.md +4 -1
- package/skills/cometchat-android-v6-extensions/SKILL.md +2 -1
- package/skills/cometchat-android-v6-features/SKILL.md +26 -2
- package/skills/cometchat-android-v6-kotlin-components/SKILL.md +31 -1
- package/skills/cometchat-android-v6-kotlin-customization/SKILL.md +172 -1
- package/skills/cometchat-android-v6-kotlin-placement/SKILL.md +20 -5
- package/skills/cometchat-android-v6-kotlin-theming/SKILL.md +36 -5
- package/skills/cometchat-android-v6-migration/SKILL.md +44 -42
- package/skills/cometchat-android-v6-production/SKILL.md +6 -3
- package/skills/cometchat-android-v6-push/SKILL.md +43 -2
- package/skills/cometchat-android-v6-testing/SKILL.md +11 -8
- package/skills/cometchat-android-v6-troubleshooting/SKILL.md +26 -5
- package/skills/cometchat-angular-calls/SKILL.md +256 -389
- package/skills/cometchat-angular-calls/references/add-calls-to-existing-chat.md +3 -2
- package/skills/cometchat-angular-calls/references/call-layouts.md +29 -12
- package/skills/cometchat-angular-calls/references/call-session.md +2 -2
- package/skills/cometchat-angular-calls/references/custom-ui.md +18 -10
- package/skills/cometchat-angular-calls/references/device-management.md +53 -34
- package/skills/cometchat-angular-calls/references/group-calls.md +45 -24
- package/skills/cometchat-angular-calls/references/idle-timeout.md +31 -15
- package/skills/cometchat-angular-calls/references/ngzone-and-async-callbacks.md +7 -6
- package/skills/cometchat-angular-calls/references/raise-hand.md +9 -4
- package/skills/cometchat-angular-calls/references/recording-screen-share.md +32 -39
- package/skills/cometchat-angular-calls/references/ringing-integration.md +3 -1
- package/skills/cometchat-angular-calls/references/share-invite.md +11 -5
- package/skills/cometchat-angular-calls/references/virtual-background.md +29 -0
- package/skills/cometchat-angular-components/SKILL.md +149 -620
- package/skills/cometchat-angular-core/SKILL.md +235 -293
- package/skills/cometchat-angular-customization/SKILL.md +415 -223
- package/skills/cometchat-angular-features/SKILL.md +216 -334
- package/skills/cometchat-angular-patterns/SKILL.md +168 -359
- package/skills/cometchat-angular-placement/SKILL.md +189 -560
- package/skills/cometchat-angular-production/SKILL.md +241 -92
- package/skills/cometchat-angular-push/SKILL.md +280 -294
- package/skills/cometchat-angular-testing/SKILL.md +430 -158
- package/skills/cometchat-angular-theming/SKILL.md +190 -265
- package/skills/cometchat-angular-troubleshooting/SKILL.md +192 -157
- package/skills/cometchat-astro-patterns/SKILL.md +22 -1
- package/skills/cometchat-calls/SKILL.md +25 -19
- package/skills/cometchat-calls/references/use-case-broadcast.md +15 -10
- package/skills/cometchat-calls/references/use-case-marketplace.md +2 -3
- package/skills/cometchat-calls/references/use-case-support.md +3 -4
- package/skills/cometchat-calls/references/use-case-team.md +23 -12
- package/skills/cometchat-calls/references/use-case-telehealth.md +3 -4
- package/skills/cometchat-components/SKILL.md +163 -25
- package/skills/cometchat-core/SKILL.md +412 -13
- package/skills/cometchat-customization/SKILL.md +50 -25
- package/skills/cometchat-features/SKILL.md +313 -34
- package/skills/cometchat-flutter-v5/SKILL.md +10 -4
- package/skills/cometchat-flutter-v5-calls/SKILL.md +188 -158
- package/skills/cometchat-flutter-v5-calls/references/add-calls-to-existing-chat.md +48 -24
- package/skills/cometchat-flutter-v5-calls/references/call-layouts.md +20 -15
- package/skills/cometchat-flutter-v5-calls/references/call-session.md +100 -145
- package/skills/cometchat-flutter-v5-calls/references/device-management.md +12 -8
- package/skills/cometchat-flutter-v5-calls/references/group-calls.md +30 -36
- package/skills/cometchat-flutter-v5-calls/references/idle-timeout.md +15 -13
- package/skills/cometchat-flutter-v5-calls/references/in-call-chat.md +12 -9
- package/skills/cometchat-flutter-v5-calls/references/migration-v4-to-v5.md +115 -65
- package/skills/cometchat-flutter-v5-calls/references/raise-hand.md +41 -30
- package/skills/cometchat-flutter-v5-calls/references/ringing-integration.md +17 -14
- package/skills/cometchat-flutter-v5-calls/references/share-invite.md +8 -2
- package/skills/cometchat-flutter-v5-conversations/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-core/SKILL.md +20 -2
- package/skills/cometchat-flutter-v5-customization/SKILL.md +136 -5
- package/skills/cometchat-flutter-v5-events/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-messages/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-production/SKILL.md +15 -6
- package/skills/cometchat-flutter-v5-push/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-testing/SKILL.md +17 -6
- package/skills/cometchat-flutter-v5-theming/SKILL.md +2 -1
- package/skills/cometchat-flutter-v5-troubleshooting/SKILL.md +7 -6
- package/skills/cometchat-flutter-v5-users-groups/SKILL.md +3 -2
- package/skills/cometchat-flutter-v6/SKILL.md +17 -16
- package/skills/cometchat-flutter-v6-calls/SKILL.md +78 -63
- package/skills/cometchat-flutter-v6-calls/references/add-calls-to-existing-chat.md +8 -6
- package/skills/cometchat-flutter-v6-calls/references/advanced-features.md +89 -0
- package/skills/cometchat-flutter-v6-calls/references/call-layouts.md +15 -12
- package/skills/cometchat-flutter-v6-calls/references/call-session.md +2 -2
- package/skills/cometchat-flutter-v6-calls/references/device-management.md +9 -3
- package/skills/cometchat-flutter-v6-calls/references/group-calls.md +10 -10
- package/skills/cometchat-flutter-v6-calls/references/idle-timeout.md +15 -7
- package/skills/cometchat-flutter-v6-calls/references/in-call-chat.md +6 -3
- package/skills/cometchat-flutter-v6-calls/references/raise-hand.md +23 -16
- package/skills/cometchat-flutter-v6-components/SKILL.md +32 -11
- package/skills/cometchat-flutter-v6-conversations/SKILL.md +39 -11
- package/skills/cometchat-flutter-v6-core/SKILL.md +348 -10
- package/skills/cometchat-flutter-v6-customization/SKILL.md +97 -25
- package/skills/cometchat-flutter-v6-events/SKILL.md +3 -2
- package/skills/cometchat-flutter-v6-features/SKILL.md +15 -6
- package/skills/cometchat-flutter-v6-messages/SKILL.md +111 -60
- package/skills/cometchat-flutter-v6-migration/SKILL.md +18 -25
- package/skills/cometchat-flutter-v6-placement/SKILL.md +79 -50
- package/skills/cometchat-flutter-v6-production/SKILL.md +13 -12
- package/skills/cometchat-flutter-v6-push/SKILL.md +43 -21
- package/skills/cometchat-flutter-v6-testing/SKILL.md +6 -6
- package/skills/cometchat-flutter-v6-theming/SKILL.md +38 -5
- package/skills/cometchat-flutter-v6-troubleshooting/SKILL.md +182 -17
- package/skills/cometchat-flutter-v6-users-groups/SKILL.md +12 -4
- package/skills/cometchat-i18n/SKILL.md +139 -78
- package/skills/cometchat-ios/SKILL.md +4 -2
- package/skills/cometchat-ios-calls/SKILL.md +225 -95
- package/skills/cometchat-ios-calls/references/add-calls-to-existing-chat.md +11 -9
- package/skills/cometchat-ios-calls/references/audio-modes-and-controls.md +45 -0
- package/skills/cometchat-ios-calls/references/avaudiosession-routing.md +6 -7
- package/skills/cometchat-ios-calls/references/call-layouts.md +31 -91
- package/skills/cometchat-ios-calls/references/call-session.md +51 -54
- package/skills/cometchat-ios-calls/references/callkit-and-pushkit.md +33 -29
- package/skills/cometchat-ios-calls/references/custom-ui.md +38 -38
- package/skills/cometchat-ios-calls/references/group-calls.md +33 -70
- package/skills/cometchat-ios-calls/references/idle-timeout.md +24 -25
- package/skills/cometchat-ios-calls/references/in-call-chat.md +19 -23
- package/skills/cometchat-ios-calls/references/migration-v4-to-v5.md +128 -70
- package/skills/cometchat-ios-calls/references/picture-in-picture.md +20 -20
- package/skills/cometchat-ios-calls/references/raise-hand.md +14 -227
- package/skills/cometchat-ios-calls/references/recording-screen-share.md +35 -122
- package/skills/cometchat-ios-calls/references/ringing-integration.md +17 -16
- package/skills/cometchat-ios-calls/references/share-invite.md +8 -12
- package/skills/cometchat-ios-calls/references/swiftui-uikit-hosting.md +4 -4
- package/skills/cometchat-ios-components/SKILL.md +200 -12
- package/skills/cometchat-ios-core/SKILL.md +281 -11
- package/skills/cometchat-ios-customization/SKILL.md +276 -110
- package/skills/cometchat-ios-features/SKILL.md +64 -36
- package/skills/cometchat-ios-placement/SKILL.md +15 -12
- package/skills/cometchat-ios-production/SKILL.md +12 -4
- package/skills/cometchat-ios-push/SKILL.md +53 -19
- package/skills/cometchat-ios-testing/SKILL.md +14 -9
- package/skills/cometchat-ios-theming/SKILL.md +39 -3
- package/skills/cometchat-ios-troubleshooting/SKILL.md +41 -21
- package/skills/cometchat-native-bare-patterns/SKILL.md +56 -18
- package/skills/cometchat-native-calls/SKILL.md +89 -19
- package/skills/cometchat-native-calls/references/add-calls-to-existing-chat.md +2 -2
- package/skills/cometchat-native-calls/references/call-layouts.md +15 -14
- package/skills/cometchat-native-calls/references/call-session.md +2 -2
- package/skills/cometchat-native-calls/references/custom-ui.md +12 -8
- package/skills/cometchat-native-calls/references/device-management.md +53 -30
- package/skills/cometchat-native-calls/references/group-calls.md +35 -30
- package/skills/cometchat-native-calls/references/idle-timeout.md +6 -6
- package/skills/cometchat-native-calls/references/in-call-chat.md +10 -8
- package/skills/cometchat-native-calls/references/migration-v4-to-v5.md +2 -2
- package/skills/cometchat-native-calls/references/raise-hand.md +15 -13
- package/skills/cometchat-native-calls/references/recording-screen-share.md +49 -170
- package/skills/cometchat-native-calls/references/share-invite.md +7 -5
- package/skills/cometchat-native-calls/references/voip-push-end-to-end.md +4 -2
- package/skills/cometchat-native-components/SKILL.md +91 -57
- package/skills/cometchat-native-core/SKILL.md +281 -9
- package/skills/cometchat-native-customization/SKILL.md +150 -28
- package/skills/cometchat-native-expo-patterns/SKILL.md +77 -27
- package/skills/cometchat-native-features/SKILL.md +79 -49
- package/skills/cometchat-native-placement/SKILL.md +19 -10
- package/skills/cometchat-native-production/SKILL.md +9 -3
- package/skills/cometchat-native-push/SKILL.md +2 -1
- package/skills/cometchat-native-testing/SKILL.md +1 -2
- package/skills/cometchat-native-theming/SKILL.md +54 -29
- package/skills/cometchat-native-troubleshooting/SKILL.md +71 -3
- package/skills/cometchat-nextjs-patterns/SKILL.md +48 -6
- package/skills/cometchat-placement/SKILL.md +42 -3
- package/skills/cometchat-production/SKILL.md +12 -5
- package/skills/cometchat-react-calls/SKILL.md +220 -10
- package/skills/cometchat-react-calls/references/add-calls-to-existing-chat.md +4 -3
- package/skills/cometchat-react-calls/references/call-layouts.md +5 -6
- package/skills/cometchat-react-calls/references/call-session.md +1 -1
- package/skills/cometchat-react-calls/references/custom-ui.md +61 -15
- package/skills/cometchat-react-calls/references/device-management.md +55 -51
- package/skills/cometchat-react-calls/references/group-calls.md +18 -23
- package/skills/cometchat-react-calls/references/idle-timeout.md +25 -12
- package/skills/cometchat-react-calls/references/in-call-chat.md +7 -7
- package/skills/cometchat-react-calls/references/migration-v4-to-v5.md +9 -11
- package/skills/cometchat-react-calls/references/raise-hand.md +14 -14
- package/skills/cometchat-react-calls/references/recording-screen-share.md +39 -38
- package/skills/cometchat-react-calls/references/ringing-integration.md +2 -2
- package/skills/cometchat-react-calls/references/share-invite.md +4 -5
- package/skills/cometchat-react-calls/references/testing-calls-on-web.md +20 -2
- package/skills/cometchat-react-calls/references/virtual-background.md +32 -0
- package/skills/cometchat-react-patterns/SKILL.md +57 -4
- package/skills/cometchat-react-push/SKILL.md +258 -72
- package/skills/cometchat-react-router-patterns/SKILL.md +43 -4
- package/skills/cometchat-react-testing/SKILL.md +14 -5
- package/skills/cometchat-theming/SKILL.md +181 -18
- package/skills/cometchat-troubleshooting/SKILL.md +40 -20
|
@@ -1,54 +1,59 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: cometchat-angular-production
|
|
3
|
-
description: "Production-readiness for Angular — server-minted auth tokens, user management CRUD, external-backend recipes (Express / Hono / Firebase Functions / Vercel). Angular
|
|
3
|
+
description: "Production-readiness for CometChat Angular UI Kit v5 (@cometchat/chat-uikit-angular@5) — server-minted auth tokens via CometChatUIKit.loginWithAuthToken(authToken), user management CRUD, environment.prod.ts hardening (no authKey, no REST API Key), external-backend recipes (Express / Hono / Firebase Functions / Vercel), and the security checklist. Angular ships src/ to the client, so the REST API Key is always server-only."
|
|
4
4
|
license: "MIT"
|
|
5
|
-
compatibility: "Angular >=
|
|
6
|
-
allowed-tools: "shell, file-read, file-search, file-list, ask-user"
|
|
5
|
+
compatibility: "Angular >=17 <22; @cometchat/chat-uikit-angular ^5.0; @cometchat/chat-sdk-javascript ^4.1"
|
|
7
6
|
metadata:
|
|
8
7
|
author: "CometChat"
|
|
9
|
-
version: "
|
|
10
|
-
tags: "cometchat angular production auth token security user-management rest-api"
|
|
8
|
+
version: "4.0.0"
|
|
9
|
+
tags: "cometchat angular production auth token security user-management rest-api v5 standalone"
|
|
11
10
|
---
|
|
12
11
|
|
|
13
12
|
## Purpose
|
|
14
13
|
|
|
15
|
-
Teaches Claude how to move
|
|
14
|
+
Teaches Claude how to move a CometChat **Angular UI Kit v5** (`@cometchat/chat-uikit-angular@5`) integration from dev-mode Auth Key to production-ready server-minted auth tokens + user CRUD. Covers:
|
|
16
15
|
|
|
17
16
|
1. Why the dev `authKey` can't ship to production
|
|
18
17
|
2. Auth Key vs REST API Key — which lives where
|
|
19
|
-
3.
|
|
20
|
-
4.
|
|
21
|
-
5.
|
|
22
|
-
6.
|
|
18
|
+
3. The token auth pattern (4 steps)
|
|
19
|
+
4. Server endpoint recipes (Express / Hono / Firebase Functions / Vercel) — Angular has no API routes, so the backend is always external
|
|
20
|
+
5. Client-side: `CometChatUIKit.loginWithAuthToken(authToken)` + token refresh
|
|
21
|
+
6. User CRUD — the REST API (production path) and the client helpers (`CometChatUIKit.createUser` / `updateUser`)
|
|
22
|
+
7. Environment files (`environment.ts` → `environment.prod.ts`) + production build
|
|
23
|
+
8. Security checklist
|
|
23
24
|
|
|
24
|
-
**Read `cometchat-angular-core` first** — production just swaps one call on the init
|
|
25
|
+
**Read `cometchat-angular-core` first** — production just swaps one call on the init/login flow, but understanding the standalone `init → login → render` lifecycle is the prerequisite.
|
|
25
26
|
|
|
26
|
-
Ground truth: `docs/ui-kit/angular/
|
|
27
|
+
Ground truth: `@cometchat/chat-uikit-angular@5.0.2` source (`projects/cometchat-uikit/src/lib/cometchat-uikit.ts` — the `CometChatUIKit` class with both static and injectable APIs), the sample-app login flow (`projects/sample-app/src` — `main.ts` init, `services/auth.service.ts` login/logout), `docs/ui-kit/angular/integration.mdx` + `docs/fundamentals/user-auth`, and the cross-platform REST API at `https://{APP_ID}.api-{REGION}.cometchat.io/v3/`. Verify any non-obvious symbol against the kit source before relying on it. **Official docs:** https://www.cometchat.com/docs/fundamentals/user-auth · **Docs MCP:** `claude mcp add --transport http cometchat-docs https://www.cometchat.com/docs/mcp` (or fetch the URL directly without MCP).
|
|
27
28
|
|
|
28
29
|
---
|
|
29
30
|
|
|
30
31
|
## 1. Why production auth matters
|
|
31
32
|
|
|
32
|
-
In dev mode, `CometChatUIKit.login(
|
|
33
|
+
In dev mode, `CometChatUIKit.login(uid)` uses the `authKey` passed to `UIKitSettingsBuilder.setAuthKey()`. That key is bundled into your Angular JavaScript. Anyone can open DevTools → Sources → search for the key string and use it to log in as **ANY** user in your CometChat app — read private messages, send as other users, access every conversation.
|
|
33
34
|
|
|
34
35
|
Production MUST use server-side token generation:
|
|
35
36
|
|
|
36
37
|
- Your **server** holds the REST API Key (a different key from the client Auth Key).
|
|
37
38
|
- On user login, your server calls CometChat's REST API with the REST API Key to mint a short-lived **Auth Token** for that specific UID.
|
|
38
|
-
- Your Angular client receives the Auth Token and calls `CometChatUIKit.
|
|
39
|
+
- Your Angular client receives the Auth Token and calls `CometChatUIKit.loginWithAuthToken(authToken)`.
|
|
39
40
|
- If the token leaks, the blast radius is one user session, not your whole app.
|
|
40
41
|
|
|
42
|
+
The dev `setAuthKey()` call MUST NOT ship in production builds. See §7 for the `environment.prod.ts` swap.
|
|
43
|
+
|
|
41
44
|
---
|
|
42
45
|
|
|
43
46
|
## 2. Auth Key vs REST API Key — two different keys
|
|
44
47
|
|
|
45
48
|
| Key | Where in dashboard | Purpose | Where it lives |
|
|
46
49
|
|---|---|---|---|
|
|
47
|
-
| **Auth Key** | "Auth Keys" table | Client-side SDK `login(
|
|
48
|
-
| **REST API Key** | "REST API Keys" table | Server-to-server: token generation, user CRUD | **Server only.** Never in `environment.ts`, `environment.prod.ts`, or any
|
|
50
|
+
| **Auth Key** | API & Auth Keys → "Auth Keys" table | Client-side SDK `login(uid)` in dev mode | **Client bundle** — dev only. Never in production builds. |
|
|
51
|
+
| **REST API Key** | API & Auth Keys → "REST API Keys" table | Server-to-server: token generation, user CRUD | **Server only.** Never in `environment.ts`, `environment.prod.ts`, or any file under `src/`. |
|
|
49
52
|
|
|
50
53
|
If the project only has an Auth Key, the user needs to generate a REST API Key in the dashboard: **API & Auth Keys → REST API Keys → Add Key**. Pick "Full Access" for server-side use.
|
|
51
54
|
|
|
55
|
+
**Why this matters more in Angular than elsewhere:** Angular has no server runtime and no `process.env` split. Everything under `src/` — including both `environment.ts` files — is compiled into the client bundle. There is no framework-prefix convention (`NEXT_PUBLIC_`, `VITE_`) that decides client vs server. So the rule is absolute: the REST API Key never appears in any Angular source file.
|
|
56
|
+
|
|
52
57
|
---
|
|
53
58
|
|
|
54
59
|
## 3. The token auth pattern (4 steps)
|
|
@@ -57,21 +62,30 @@ If the project only has an Auth Key, the user needs to generate a REST API Key i
|
|
|
57
62
|
1. User logs into YOUR auth (Firebase Auth / Supabase / Clerk / Auth0 / custom)
|
|
58
63
|
↓
|
|
59
64
|
2. Angular app asks YOUR backend for a CometChat auth token
|
|
60
|
-
↓ (POST /api/cometchat-token with Authorization: Bearer <jwt>)
|
|
65
|
+
↓ (POST /api/cometchat-token with Authorization: Bearer <your-jwt>)
|
|
61
66
|
3. Backend calls CometChat REST API → gets an Auth Token for that UID
|
|
62
67
|
↓ POST https://{APP_ID}.api-{REGION}.cometchat.io/v3/users/{uid}/auth_tokens
|
|
63
68
|
with header apiKey: <REST_API_KEY>
|
|
64
69
|
↓
|
|
65
|
-
4. Angular calls CometChatUIKit.
|
|
70
|
+
4. Angular calls CometChatUIKit.loginWithAuthToken(authToken)
|
|
66
71
|
```
|
|
67
72
|
|
|
68
|
-
The Angular client never sees the REST API Key. The
|
|
73
|
+
The Angular client never sees the REST API Key. The backend derives the UID from the authenticated session — never from the request body (see anti-patterns §9).
|
|
74
|
+
|
|
75
|
+
The CometChat REST API requires two headers on every server-to-server call:
|
|
76
|
+
- `appId` — your CometChat app ID
|
|
77
|
+
- `apiKey` — your **REST API Key** (NOT the Auth Key used in dev mode)
|
|
69
78
|
|
|
70
79
|
---
|
|
71
80
|
|
|
72
81
|
## 4. Server endpoint recipes
|
|
73
82
|
|
|
74
|
-
Angular projects
|
|
83
|
+
Angular projects have **no built-in API routes**. You need a separate backend. The token endpoint does the same thing in every recipe:
|
|
84
|
+
|
|
85
|
+
1. Validate the caller is authenticated (your existing auth middleware/guard).
|
|
86
|
+
2. Derive the UID from the authenticated session.
|
|
87
|
+
3. POST to `https://{APP_ID}.api-{REGION}.cometchat.io/v3/users/{uid}/auth_tokens` with the `apiKey` header.
|
|
88
|
+
4. Return `{ authToken }` to the client.
|
|
75
89
|
|
|
76
90
|
### 4a. Express (Node.js backend)
|
|
77
91
|
|
|
@@ -86,7 +100,7 @@ const REGION = process.env.COMETCHAT_REGION!;
|
|
|
86
100
|
const REST_API_KEY = process.env.COMETCHAT_REST_API_KEY!;
|
|
87
101
|
|
|
88
102
|
router.post("/cometchat-token", requireAuth, async (req, res) => {
|
|
89
|
-
const uid = req.user.id;
|
|
103
|
+
const uid = req.user.id; // from authenticated session — NOT from request body
|
|
90
104
|
|
|
91
105
|
const r = await fetch(
|
|
92
106
|
`https://${APP_ID}.api-${REGION}.cometchat.io/v3/users/${encodeURIComponent(uid)}/auth_tokens`,
|
|
@@ -102,6 +116,7 @@ router.post("/cometchat-token", requireAuth, async (req, res) => {
|
|
|
102
116
|
);
|
|
103
117
|
|
|
104
118
|
if (!r.ok) {
|
|
119
|
+
console.error("CometChat token error:", await r.text());
|
|
105
120
|
return res.status(r.status).json({ error: "Failed to generate auth token" });
|
|
106
121
|
}
|
|
107
122
|
|
|
@@ -112,6 +127,13 @@ router.post("/cometchat-token", requireAuth, async (req, res) => {
|
|
|
112
127
|
export default router;
|
|
113
128
|
```
|
|
114
129
|
|
|
130
|
+
Enable CORS for your Angular origin (e.g. `http://localhost:4200` in dev) so the browser can call this endpoint:
|
|
131
|
+
|
|
132
|
+
```typescript
|
|
133
|
+
import cors from "cors";
|
|
134
|
+
app.use(cors({ origin: "http://localhost:4200" }));
|
|
135
|
+
```
|
|
136
|
+
|
|
115
137
|
### 4b. Hono (Cloudflare Workers / Bun / Node)
|
|
116
138
|
|
|
117
139
|
```typescript
|
|
@@ -210,6 +232,8 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
|
|
|
210
232
|
|
|
211
233
|
## 5. Client-side: Angular service for production auth
|
|
212
234
|
|
|
235
|
+
The v5 production login call is **`CometChatUIKit.loginWithAuthToken(authToken)`** — it takes a **bare token string**, the same way v5 dev login takes a bare uid string (`CometChatUIKit.login(uid)`). Do NOT pass an object — `loginWithAuthToken({ authToken })` is a v4-ism and will not compile against the v5 types (verified: `static loginWithAuthToken(authToken: string): Promise<CometChat.User>`).
|
|
236
|
+
|
|
213
237
|
```typescript
|
|
214
238
|
// cometchat-auth.service.ts
|
|
215
239
|
import { Injectable } from "@angular/core";
|
|
@@ -223,11 +247,14 @@ export class CometChatAuthService {
|
|
|
223
247
|
constructor(private http: HttpClient) {}
|
|
224
248
|
|
|
225
249
|
async loginWithToken(appJwt: string): Promise<void> {
|
|
226
|
-
// 1.
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
//
|
|
250
|
+
// 1. Already logged in? getLoggedInUser() (capital I) is the SYNC v5 accessor —
|
|
251
|
+
// returns CometChat.User | null from the cached BehaviorSubject, no await.
|
|
252
|
+
// (There is also an async getLoggedinUser() — lowercase i — returning
|
|
253
|
+
// Promise<CometChat.User | null>; the sample-app route guards use that one.
|
|
254
|
+
// Both are real v5 symbols; pick sync for a fast already-logged-in short-circuit.)
|
|
255
|
+
if (CometChatUIKit.getLoggedInUser()) return;
|
|
256
|
+
|
|
257
|
+
// 2. Fetch a CometChat auth token from your backend.
|
|
231
258
|
const response = await firstValueFrom(
|
|
232
259
|
this.http.post<{ authToken: string }>(
|
|
233
260
|
environment.cometchat.tokenEndpoint,
|
|
@@ -236,8 +263,8 @@ export class CometChatAuthService {
|
|
|
236
263
|
)
|
|
237
264
|
);
|
|
238
265
|
|
|
239
|
-
// 3.
|
|
240
|
-
await CometChatUIKit.
|
|
266
|
+
// 3. Log in with the bare token string (v5 signature).
|
|
267
|
+
await CometChatUIKit.loginWithAuthToken(response.authToken);
|
|
241
268
|
}
|
|
242
269
|
|
|
243
270
|
async logout(): Promise<void> {
|
|
@@ -250,9 +277,13 @@ export class CometChatAuthService {
|
|
|
250
277
|
// app.component.ts — production-aware init
|
|
251
278
|
import { Component, OnInit } from "@angular/core";
|
|
252
279
|
import { CometChatAuthService } from "./cometchat-auth.service";
|
|
253
|
-
import { YourAuthService } from "./your-auth.service";
|
|
280
|
+
import { YourAuthService } from "./your-auth.service"; // your existing auth
|
|
254
281
|
|
|
255
|
-
@Component({
|
|
282
|
+
@Component({
|
|
283
|
+
selector: "app-root",
|
|
284
|
+
standalone: true,
|
|
285
|
+
templateUrl: "./app.component.html",
|
|
286
|
+
})
|
|
256
287
|
export class AppComponent implements OnInit {
|
|
257
288
|
isReady = false;
|
|
258
289
|
|
|
@@ -262,59 +293,95 @@ export class AppComponent implements OnInit {
|
|
|
262
293
|
) {}
|
|
263
294
|
|
|
264
295
|
ngOnInit(): void {
|
|
265
|
-
//
|
|
266
|
-
this.yourAuth
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
this.isReady = true
|
|
270
|
-
|
|
296
|
+
// CometChatUIKit.init() already ran via APP_INITIALIZER (see cometchat-angular-core).
|
|
297
|
+
this.yourAuth
|
|
298
|
+
.getJwt()
|
|
299
|
+
.then((jwt) => this.cometChatAuth.loginWithToken(jwt))
|
|
300
|
+
.then(() => (this.isReady = true))
|
|
301
|
+
.catch(console.error);
|
|
271
302
|
}
|
|
272
303
|
}
|
|
273
304
|
```
|
|
274
305
|
|
|
275
|
-
|
|
306
|
+
Gate the chat UI on `isReady` so no `<cometchat-*>` component renders before `loginWithAuthToken` resolves.
|
|
307
|
+
|
|
308
|
+
### Token refresh on disconnect / expiry
|
|
309
|
+
|
|
310
|
+
CometChat auth tokens expire. When a token expires, the SDK disconnects. Re-mint and re-login through a single in-flight guard so concurrent triggers don't fire two logins (the SDK throws *"Please wait until the previous login request ends."* on a racing second `loginWithAuthToken`).
|
|
276
311
|
|
|
277
312
|
```typescript
|
|
278
|
-
//
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
313
|
+
// In CometChatAuthService — module/instance-level guard.
|
|
314
|
+
private refreshInFlight: Promise<void> | null = null;
|
|
315
|
+
|
|
316
|
+
async refreshSession(appJwt: string): Promise<void> {
|
|
317
|
+
if (this.refreshInFlight) {
|
|
318
|
+
await this.refreshInFlight; // another caller already triggered a refresh
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
this.refreshInFlight = (async () => {
|
|
322
|
+
const response = await firstValueFrom(
|
|
323
|
+
this.http.post<{ authToken: string }>(
|
|
324
|
+
environment.cometchat.tokenEndpoint,
|
|
325
|
+
{},
|
|
326
|
+
{ headers: new HttpHeaders({ Authorization: `Bearer ${appJwt}` }) }
|
|
327
|
+
)
|
|
328
|
+
);
|
|
329
|
+
await CometChatUIKit.loginWithAuthToken(response.authToken);
|
|
330
|
+
})();
|
|
331
|
+
try {
|
|
332
|
+
await this.refreshInFlight;
|
|
333
|
+
} finally {
|
|
334
|
+
this.refreshInFlight = null;
|
|
335
|
+
}
|
|
336
|
+
}
|
|
288
337
|
```
|
|
289
338
|
|
|
339
|
+
Wire `refreshSession` to a `CometChat.addConnectionListener(...)` `onDisconnected` handler, or simply re-mint and re-login whenever a CometChat operation returns an auth error.
|
|
340
|
+
|
|
290
341
|
---
|
|
291
342
|
|
|
292
343
|
## 6. User management CRUD
|
|
293
344
|
|
|
294
|
-
|
|
345
|
+
In production you keep CometChat users in sync with your app's users. There are two paths:
|
|
346
|
+
|
|
347
|
+
**The production path is the REST API** (server-side, REST API Key). Create the CometChat user the moment the app user signs up — otherwise `loginWithAuthToken` fails with *"user does not exist."*
|
|
295
348
|
|
|
296
|
-
|
|
349
|
+
**The client helpers exist too** — `CometChatUIKit.createUser(user)` and `CometChatUIKit.updateUser(user)` are exported by the v5 kit (verified: both `(user: CometChat.User): Promise<CometChat.User>`). But they require the Auth Key on the UIKitSettings to authorize, which is exactly what you remove in production. **Treat them as a dev/admin-tool convenience, not the production user-provisioning mechanism.** Production provisioning belongs server-side via the REST API. (Note: the kit exposes `createUser`/`updateUser` only — there is no client-side `deleteUser`; deletion is REST-only.)
|
|
350
|
+
|
|
351
|
+
If you do use the client helper (e.g. a one-off admin screen running with the Auth Key), the shape is a `CometChat.User`:
|
|
352
|
+
|
|
353
|
+
```typescript
|
|
354
|
+
import { CometChat } from "@cometchat/chat-sdk-javascript";
|
|
355
|
+
import { CometChatUIKit } from "@cometchat/chat-uikit-angular";
|
|
356
|
+
|
|
357
|
+
const user = new CometChat.User("user-uid-1");
|
|
358
|
+
user.setName("Alice");
|
|
359
|
+
await CometChatUIKit.createUser(user); // Promise<CometChat.User>
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### 6a. Create a user on signup (REST — production path)
|
|
297
363
|
|
|
298
364
|
```typescript
|
|
299
365
|
async function createCometChatUser(uid: string, name: string, avatarUrl?: string) {
|
|
300
|
-
const r = await fetch(
|
|
301
|
-
|
|
302
|
-
{
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
366
|
+
const r = await fetch(`https://${APP_ID}.api-${REGION}.cometchat.io/v3/users`, {
|
|
367
|
+
method: "POST",
|
|
368
|
+
headers: {
|
|
369
|
+
"Content-Type": "application/json",
|
|
370
|
+
appId: APP_ID,
|
|
371
|
+
apiKey: REST_API_KEY,
|
|
372
|
+
},
|
|
373
|
+
body: JSON.stringify({ uid, name, ...(avatarUrl ? { avatar: avatarUrl } : {}) }),
|
|
374
|
+
});
|
|
375
|
+
if (!r.ok) {
|
|
376
|
+
// 409 = user already exists — safe to ignore on re-signup.
|
|
377
|
+
if (r.status === 409) return;
|
|
378
|
+
throw new Error(`CometChat user create failed: ${await r.text()}`);
|
|
379
|
+
}
|
|
313
380
|
return r.json();
|
|
314
381
|
}
|
|
315
382
|
```
|
|
316
383
|
|
|
317
|
-
### 6b. Update a user on profile change
|
|
384
|
+
### 6b. Update a user on profile change (REST)
|
|
318
385
|
|
|
319
386
|
```typescript
|
|
320
387
|
async function updateCometChatUser(uid: string, updates: { name?: string; avatar?: string }) {
|
|
@@ -335,7 +402,7 @@ async function updateCometChatUser(uid: string, updates: { name?: string; avatar
|
|
|
335
402
|
}
|
|
336
403
|
```
|
|
337
404
|
|
|
338
|
-
### 6c. Delete a user on account deletion
|
|
405
|
+
### 6c. Delete a user on account deletion (REST only)
|
|
339
406
|
|
|
340
407
|
```typescript
|
|
341
408
|
async function deleteCometChatUser(uid: string) {
|
|
@@ -355,48 +422,129 @@ async function deleteCometChatUser(uid: string) {
|
|
|
355
422
|
}
|
|
356
423
|
```
|
|
357
424
|
|
|
425
|
+
### 6d. Where to hook user CRUD into common auth providers
|
|
426
|
+
|
|
427
|
+
- **Firebase Auth** — `functions.auth.user().onCreate(...)` → `createCometChatUser`; `.onDelete(...)` → `deleteCometChatUser`. Firebase fires no event on profile change, so call `updateCometChatUser` from your profile-update endpoint.
|
|
428
|
+
- **Supabase** — a Database Webhook on `auth.users` (INSERT/UPDATE/DELETE) → the matching CRUD helper.
|
|
429
|
+
- **Clerk** — the `user.created` / `user.updated` / `user.deleted` webhook events (verify the svix signature first).
|
|
430
|
+
- **Auth0** — a post-registration Action / Log Stream webhook → `createCometChatUser`.
|
|
431
|
+
|
|
358
432
|
---
|
|
359
433
|
|
|
360
|
-
## 7. Environment
|
|
434
|
+
## 7. Environment files + production build
|
|
435
|
+
|
|
436
|
+
Angular has no `.env` / `process.env`. Config lives in `src/environments/`. The production build (`ng build --configuration production`) swaps `environment.ts` → `environment.prod.ts` via the `fileReplacements` in `angular.json`. **The split is your only lever** — anything in the active file ships to the client.
|
|
437
|
+
|
|
438
|
+
### Dev environment (Auth Key — never built for production)
|
|
439
|
+
|
|
440
|
+
```typescript
|
|
441
|
+
// src/environments/environment.ts (development)
|
|
442
|
+
export const environment = {
|
|
443
|
+
production: false,
|
|
444
|
+
cometchat: {
|
|
445
|
+
appId: "YOUR_APP_ID",
|
|
446
|
+
region: "us", // "us" | "eu" | "in"
|
|
447
|
+
authKey: "YOUR_AUTH_KEY", // dev only — must NOT exist in environment.prod.ts
|
|
448
|
+
},
|
|
449
|
+
};
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
### Production environment (no Auth Key, no REST API Key — just a token endpoint)
|
|
453
|
+
|
|
454
|
+
```typescript
|
|
455
|
+
// src/environments/environment.prod.ts (production)
|
|
456
|
+
export const environment = {
|
|
457
|
+
production: true,
|
|
458
|
+
cometchat: {
|
|
459
|
+
appId: "YOUR_APP_ID",
|
|
460
|
+
region: "us",
|
|
461
|
+
// No authKey — mint auth tokens server-side and call loginWithAuthToken().
|
|
462
|
+
// No REST API Key — it lives on your backend only.
|
|
463
|
+
tokenEndpoint: "https://api.yourapp.com/cometchat-token",
|
|
464
|
+
},
|
|
465
|
+
};
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
### The build swap (already in angular.json for the standard schematic)
|
|
469
|
+
|
|
470
|
+
```json
|
|
471
|
+
"configurations": {
|
|
472
|
+
"production": {
|
|
473
|
+
"fileReplacements": [
|
|
474
|
+
{
|
|
475
|
+
"replace": "src/environments/environment.ts",
|
|
476
|
+
"with": "src/environments/environment.prod.ts"
|
|
477
|
+
}
|
|
478
|
+
]
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
### The init builder must drop setAuthKey() in production
|
|
484
|
+
|
|
485
|
+
Because `environment.prod.ts` has no `authKey`, the `UIKitSettingsBuilder` must not call `.setAuthKey()` in a production build. Guard it:
|
|
486
|
+
|
|
487
|
+
```typescript
|
|
488
|
+
const builder = new UIKitSettingsBuilder()
|
|
489
|
+
.setAppId(environment.cometchat.appId)
|
|
490
|
+
.setRegion(environment.cometchat.region)
|
|
491
|
+
.subscribePresenceForAllUsers();
|
|
492
|
+
|
|
493
|
+
// Dev only — the prod environment has no authKey, so this branch is skipped.
|
|
494
|
+
if (!environment.production && "authKey" in environment.cometchat) {
|
|
495
|
+
builder.setAuthKey((environment.cometchat as any).authKey);
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
await CometChatUIKit.init(builder.build());
|
|
499
|
+
```
|
|
500
|
+
|
|
501
|
+
### Variable visibility summary
|
|
361
502
|
|
|
362
503
|
| Variable | Location | Visibility |
|
|
363
504
|
|---|---|---|
|
|
364
|
-
| `
|
|
365
|
-
| `
|
|
366
|
-
| `
|
|
367
|
-
| `
|
|
368
|
-
|
|
|
505
|
+
| `appId` | `environment.ts` + `environment.prod.ts` + backend | OK client-side |
|
|
506
|
+
| `region` | `environment.ts` + `environment.prod.ts` + backend | OK client-side |
|
|
507
|
+
| `authKey` | **Dev `environment.ts` only.** Absent from `environment.prod.ts`. | Must NEVER ship in a production Angular build |
|
|
508
|
+
| `tokenEndpoint` | `environment.prod.ts` | Your backend URL — safe in client bundle |
|
|
509
|
+
| REST API Key | **Backend env only.** Never under `src/`. | Never in any Angular file, ever |
|
|
369
510
|
|
|
370
511
|
---
|
|
371
512
|
|
|
372
513
|
## 8. Security checklist
|
|
373
514
|
|
|
374
|
-
Before releasing to production:
|
|
375
|
-
|
|
376
|
-
- [ ] `authKey` removed from `environment.prod.ts
|
|
377
|
-
- [ ] Production init uses `UIKitSettingsBuilder` without `.setAuthKey()
|
|
378
|
-
- [ ] Production login uses `CometChatUIKit.
|
|
379
|
-
- [ ]
|
|
380
|
-
- [ ] Token endpoint is behind auth — unauthenticated
|
|
381
|
-
- [ ] UID
|
|
382
|
-
- [ ] Rate limit on the token endpoint (prevents abuse)
|
|
383
|
-
- [ ]
|
|
384
|
-
- [ ]
|
|
385
|
-
- [ ] CometChat user
|
|
515
|
+
Before releasing to production, verify every item:
|
|
516
|
+
|
|
517
|
+
- [ ] `authKey` removed from `environment.prod.ts`.
|
|
518
|
+
- [ ] Production init uses `UIKitSettingsBuilder` **without** `.setAuthKey()`.
|
|
519
|
+
- [ ] Production login uses `CometChatUIKit.loginWithAuthToken(authToken)` (bare string), **not** `login(uid)`.
|
|
520
|
+
- [ ] REST API Key lives only on your backend — verify with `grep -rIE "REST_API_KEY|restApiKey" src/` (must return nothing).
|
|
521
|
+
- [ ] Token endpoint is behind auth — unauthenticated callers can't mint a token for an arbitrary UID.
|
|
522
|
+
- [ ] UID is derived from the authenticated session on the backend, **not** from the request body.
|
|
523
|
+
- [ ] Rate limit on the token endpoint (prevents abuse / token farming).
|
|
524
|
+
- [ ] CORS on the token endpoint allows only your Angular origin(s).
|
|
525
|
+
- [ ] HTTPS-only — no HTTP in production.
|
|
526
|
+
- [ ] CometChat user is created (REST API) when the app user signs up — otherwise `loginWithAuthToken` fails with "user does not exist."
|
|
527
|
+
- [ ] User CRUD endpoints are authenticated (or invoked from webhooks with signature verification).
|
|
528
|
+
- [ ] CometChat user deletion runs on account deletion (GDPR / privacy compliance).
|
|
529
|
+
- [ ] Production build confirmed to swap `environment.ts` → `environment.prod.ts` (check `fileReplacements` in `angular.json`).
|
|
386
530
|
|
|
387
531
|
---
|
|
388
532
|
|
|
389
533
|
## 9. Anti-patterns
|
|
390
534
|
|
|
391
|
-
1. **NEVER put the REST API Key in any Angular file.** Not in `environment.ts`, `environment.prod.ts`, `assets/`, or any TypeScript
|
|
535
|
+
1. **NEVER put the REST API Key in any Angular file.** Not in `environment.ts`, `environment.prod.ts`, `assets/`, or any TypeScript under `src/`. Angular bundles everything in `src/` into client JavaScript. There is no `process.env` split to save you.
|
|
536
|
+
|
|
537
|
+
2. **NEVER let the client choose the UID to mint a token for.** The backend must derive UID from the authenticated session. A `POST /cometchat-token { uid: "..." }` that trusts the body is equivalent to no auth — any user can impersonate any other.
|
|
538
|
+
|
|
539
|
+
3. **Don't pass an object to `loginWithAuthToken`.** v5 takes a bare string: `loginWithAuthToken(token)`, mirroring `login(uid)`. `loginWithAuthToken({ authToken })` is a v4-era shape and won't typecheck against v5.
|
|
392
540
|
|
|
393
|
-
|
|
541
|
+
4. **Don't use `login(uid)` in production.** `uid` login requires the Auth Key on the UIKitSettings. In production set neither `.setAuthKey()` on the builder nor call `login(uid)` — use `loginWithAuthToken(token)`.
|
|
394
542
|
|
|
395
|
-
|
|
543
|
+
5. **Don't rely on `CometChatUIKit.createUser` / `updateUser` for production provisioning.** They authorize with the Auth Key (which you remove in production). Provision users server-side via the REST API; the kit helpers are a dev/admin convenience only. (And note: the kit has no client `deleteUser` — deletion is REST-only.)
|
|
396
544
|
|
|
397
|
-
|
|
545
|
+
6. **Don't cache the auth token in localStorage forever.** It expires. Re-mint on cold start, or store with a short TTL and refresh on disconnect/401 (§5).
|
|
398
546
|
|
|
399
|
-
|
|
547
|
+
7. **Don't forget user CRUD.** A user who signs up in your app but has no matching CometChat user gets "user does not exist" on `loginWithAuthToken`.
|
|
400
548
|
|
|
401
549
|
---
|
|
402
550
|
|
|
@@ -404,12 +552,13 @@ Before releasing to production:
|
|
|
404
552
|
|
|
405
553
|
| Skill | When to route |
|
|
406
554
|
|---|---|
|
|
407
|
-
| `cometchat-angular-core` | Init / login /
|
|
408
|
-
| `cometchat-angular-components` |
|
|
555
|
+
| `cometchat-angular-core` | Init / login / standalone setup / environment — prerequisite |
|
|
556
|
+
| `cometchat-angular-components` | Base component props |
|
|
409
557
|
| `cometchat-angular-placement` | Where your chat UI goes |
|
|
410
|
-
| `cometchat-angular-patterns` |
|
|
411
|
-
| `cometchat-angular-theming` |
|
|
558
|
+
| `cometchat-angular-patterns` | Standalone wiring, APP_INITIALIZER, auth guard |
|
|
559
|
+
| `cometchat-angular-theming` | CSS-variable theme customization |
|
|
412
560
|
| `cometchat-angular-features` | Feature flags |
|
|
413
|
-
| `cometchat-angular-
|
|
561
|
+
| `cometchat-angular-calls` | Voice/video calling |
|
|
562
|
+
| `cometchat-angular-customization` | Customization tied to server-side data |
|
|
414
563
|
| `cometchat-angular-production` | This skill — server tokens + user CRUD |
|
|
415
564
|
| `cometchat-angular-troubleshooting` | 401 on token fetch, "user does not exist" on login |
|