Cometchat flutter v6 production

From cometchat/cometchat-skills · View interactive version

Cometchat flutter v6 production is an AI agent skill from the GitHub repository cometchat/cometchat-skills. Take a CometChat Flutter integration to production — server-minted auth tokens instead of the Auth Key, secret handling in a Flutter bundle, logout/session hygiene, release build config, and the pre-ship checklist. Triggers: 'production auth cometchat', 'auth token flutter', 'is the auth key safe',

How to use this skill

Skill file

Ground truth: loginWithAuthToken and logout are catalog-verified against 6.1.0. Token MINTING is a server-side REST call — its exact endpoint is FETCHED from the REST API docs, never guessed. The dev-vs-prod credential rule is RULES.md §4.

Companion skills (read first)

Use this skill when

Hardening before release: "is the Auth Key safe to ship", "set up production auth", "what do I check before shipping".

Prerequisites & install

Core done. No new package.

The one thing that actually matters: the Auth Key must not ship

An Auth Key can log in as ANY user of your app. Everything core writes for development puts it in cometchat-settings.json, which is bundled into the APK/IPA — and a bundle is not a secret. Anyone can extract it.

Development (what core wired): credentials.authKey in the settings asset → CometChatUIKit.login(uid). Fine for building; never for release.

Production (what you must move to):

  1. Your server mints a per-user auth token by calling CometChat's REST API with the REST API Key (which stays on the server, never in the app).
  2. Your app authenticates the user your normal way, then asks YOUR backend for that token.
  3. The app signs in with the token:
import 'package:cometchat_chat_uikit/cometchat_chat_uikit.dart';

Future<void> signIn(String authTokenFromYourServer) async {
  await CometChatUIKit.loginWithAuthToken(
    authTokenFromYourServer,
    onSuccess: (User user) {},
    onError: (CometChatException e) {},
  );
}
  1. Remove credentials.authKey from the shipped settings file. Confirm by unzipping the release artifact and grepping for the key — do not take it on trust.

Fetch the exact token-minting endpoint from the REST API docs (../cometchat-flutter-v6-core/references/docs-map.md → SDK/REST). Never invent a URL or payload.

Session hygiene

Release build config

Pre-ship checklist

  1. No Auth Key in the release artifact (verified by inspection, not assumption).
  2. loginWithAuthToken is the only login path in prod code.
  3. Logout clears the session and unregisters push.
  4. Permission strings present on both platforms.
  5. Release build (obfuscated) actually runs — chat renders, messages send.
  6. Tested against the prod CometChat app, on real devices.
  7. Errors surface to the user rather than being swallowed in an empty onError.

Common pitfalls (BAKED)

Verify it works

The release artifact contains no Auth Key; sign-in goes through your backend; sign-out clears the session and push; a release build on a real device sends and receives; an expired token produces a clean re-auth rather than a blank screen.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.