Cannot deauthenticate sendbird call

I got the error when call deauthenticate

try {
await SendbirdCalls.deauthenticate();
} catch (error) {
console.error(Logout error with error: ${error});

Logout error with error: [Error: The user is not authenticated.]

Framework: React native
SDK: “@sendbird/calls-react-native”: “1.0.2”,
Device: iOS

Please help to check. thank you

Hello @zdungx

Welcome to the Sendbird community!

The error message “The user is not authenticated” indicates that the user is not currently authenticated with the Sendbird server. This error can occur when you try to deauthenticate a user who is not logged in or has already been logged out.

To resolve this issue, you should first check if the user is authenticated before calling the deauthenticate method. You can use the SendbirdCalls.isAuthenticated() method to check the authentication status of the user. Here’s an example of how you can modify your code:

if (SendbirdCalls.authenticated()) {
  try {
    await SendbirdCalls.deauthenticate();
  } catch (error) {
    console.error(`Logout error with error: ${error}`);
} else {
  console.error("User is not authenticated");

By checking the authentication status before calling de-authenticate, you can prevent the error from occurring when the user is not authenticated.

Let me know if this helps.

Hi @Chinmaya_Gupta
Thank you for your reply.

Yes. it should check authenticate before deauthenticate .
But it seems does not exist this func isAuthenticated()

And could you give me the right way to authenticate Sendbird call.
Should we call await SendbirdCalls.authenticate(credential); everytime open app?
I am using react native.
SDK: “@sendbird/calls-react-native”: “1.0.2”,

Hi @zdungx Sorry, that was a typo. I’ve edited it.

To authenticate the user with Sendbird Calls in your React Native app, you can use the following code:

import { SendbirdCalls } from '@sendbird/calls';

// Authenticate the user
try {
  await SendbirdCalls.authenticate(credential);
  // User is authenticated
} catch (error) {
  console.error(`Authentication error: ${error}`);

You should only call “SendbirdCall.authenticate()” once when the user logs in. There is no need to call it every time the app relaunches…

1 Like

Thank you @Chinmaya_Gupta
I call SendbirdCall.authenticate() after user logs in.
But some time i cannot received a call. I must logout then login again the call func will work.
Could you share me some step or right way to debug or find the problem.
Current implemention.

  • User Login → auth sendbird call → navigate to Home screen → Received a in comming call
  • User closed app → reopen again → open home screen → received a call in sometime.