AUTH_ERR_AUTH_TOKEN_NOT_FOUND after removing and then creating the same user
Hello, I'm getting the error: AUTH_ERR_AUTH_TOKEN_NOT_FOUND. I created a user:
CometChat.createUser(user, apiKey).then(
newUser => {
console.log('newUser created', newUser);
loginToCometChat(newUser.uid, apiKey);
},
error => {
console.log('error', error);
},
);
Afterwards, I removed the user via CometChat interface: https://app-beta.cometchat.io/app/MY_ID/users
Then when I re-created the same user (with the same UID in CometChat) and logging in (which works) I can't get any messages or conversations for this user.
"The auth token TOKEN_HERE does not exist. Please make sure you are logged in and have a valid auth token or try login again."
I've already tried to regenerate the Auth_token which resulted in me only getting the old auth_token instead of the new one.
Hello @meesrutten ,
The problem here is when you log in with user1, the authToken is stored by the SDK and used for all the API calls thereafter until you logout. Then when you delete a user from Dashboard, the SDK does not know that this user has been deleted and it keeps the old values intact. Recreating the user and calling login does nothing since internally we check if there is a logged-in user, if yes then we do not make extra API calls, and hence the older authToken which was invalidated at server level when you deleted the user is still present in the SDK. You can logout the user from the SDK while creating the user second time. And this might solve your issue. However, we are looking into this and we will come up with some tangible solution and update you here. Till then you can logout and re-login the user so that a valid authToken is stored in the SDK and you would not get the AUTH_ERR_AUTH_TOKEN_NOT_FOUND error.
Closing due to inactivity. Please re-open if you are still facing the issue.
Im also getting this error: AUTH_ERR_AUTH_TOKEN_NOT_FOUND. Im joining a group directly after login() fulfills. My logins are successful but join groups fail every time even with the successfully logged in user.
@mayur-bhandari any update on this? the issue still persists to date