Hello I'm trying to use StreamChat.io API to build a chat app but when I try to create a channel I get this error StreamChatNetworkError (StreamChatNetworkError(code: 1000, message: Unauthorised, token not defined))
Here is the code I set to join a channel
Future<void> createChannel(BuildContext context) async {
try {
final currentUser = FirebaseAuth.instance.currentUser;
final userID = currentUser!.uid;
final client = StreamChatCore.of(context).client;
final channel = client.channel("messaging", id: userID, extraData: {
"name": _name.text.trim(),
});
AccountUpdate.storeChannel(channel);
await channel.watch();
print("this is the channel output $channel");
} catch (e) {
print(e);
}
} And I have disabled Auth checks so there is no need for a secret
With help from the Stream team, I figured out that you need to establish a connected user first in order to watch a channel
EDIT: The above makes use of developer tokens (which requires authentication to be disabled). In a production environment you will need to generate frontend tokens using one of Stream's backend clients. Or for development purposes you can use the online token generator https://getstream.io/chat/docs/flutter-dart/token_generator/?language=dart
More info on connections and authentication: https://getstream.io/chat/docs/flutter-dart/tokens_and_authentication/?language=dart
See the Stream Chat Flutter getting started tutorial for more help.