I login with user X. After that deleted user’s token but isCometChatUserLogedIn still giving user data even though no API works. @mayur.bhandari
The user data is stored in local storage. Deleting auth token from Dashboard or API does not trigger any real time event for the SDK to know that the auth token has been deleted. And yes the user won’t be able to use any function since he is logged in with the deleted auth token.
You need to logout the user in the success of the delete auth token API call. I would like to know why are you deleting the auth token in the first place? Can you please let us know what are you exactly trying to achieve?
In my case i want user to be online only from the latest device he login. In case he have a phone and a laptop. First he login with laptop and then he login with phone. Then i want him to auto logout from laptop, to achieve this i am deleting previous auth tokens of that user.
As a workaround, after deleting the auth token if you get
AUTH_ERR_AUTH_TOKEN_NOT_FOUND error in any of the API response. Then you can logout that user. For eg: If the user first logs in using his phone, then logs in using laptop you delete the previous auth token. So each and every api call made from the mobile session will fail with an err
AUTH_ERR_AUTH_TOKEN_NOT_FOUND. If you get this error you can log out the user from there. Hence, ensuring that any user will have only one session at a time.