Closed lance-zigazoo closed 1 year ago
Keagan Ellis (CometChat Team) replied:
Hello Lance,
Thanks for sharing these details. We will investigate and will reach out with an update shortly.
Keagan Ellis CometChat
Jitvar (CometChat Team) replied:
Hi, I am from the Implementation team. We will check and get back to you.
Jitvar Patil Principal software Developer CometChat
Jitvar (CometChat Team) replied:
Hi,
Can you let us know where exactly are you calling CometChat.login() method. From the above snippet you have shared it looks like your CometChat.init() is being called only when you get an error when calling CometChat.login() method which is the incorrect approach.
The ideal flow should be as followed: CometChat.init() -> CometChat.login() {If the user does not exist, then call CometChat.createUser() -> CometChat.login()}. They do not have to call CometChat.login() in any other case.
Also, we noticed that you are using an older version of SDK, It's always recommended to be on the latest version as the latest version has all the optimizations and fixes. The latest version of our Chat SDK is v3.0.11.
Hope this was helpful Regards
Jitvar Patil Principal software Developer CometChat
Describe the problem
I am seeing a
API_KEY_NOT_SET
when creating a user and then logging them in with the React Native SDK.What was the expected behavior?
Create a user and then log them in.
Reproduction
Init CometChat, `const appSettings = new CometChat.AppSettingsBuilder() .subscribePresenceForAllUsers() .setRegion(REGION) .build();
await CometChat.init(COMET_CHAT_APP_ID, appSettings);`
const ccUserObj = new CometChat.User({ uid: userId, name: username }); newCometChatUser = await CometChat.createUser(ccUserObj, COMET_AUTH_KEY);
const loggedInUser = await CometChat.login(cometChatUserId, COMET_AUTH_KEY);
Full code snippet
You will see an error come back as
API_KEY_NOT_SET
, when it is in fact set. Sometimes, the error comes back as{"code": "-1", "details": {}, "message": "please initialize the cometchat before using login method.", "name": "COMETCHAT_INITIALIZATION_NOT_DONE"}
. This is also not the case, because I'm 100% certain that initialization has taken place.-Version used: "@cometchat-pro/react-native-chat": "3.0.2"