# Cannot deauthenticate sendbird call

**URL:** <https://community.sendbird.com/t/cannot-deauthenticate-sendbird-call/7709>\
**Category:** Sendbird Voice/Video Calls\
**Tags:** video-call, sendbird-call\
**Created:** [June 28, 2023, 11:19am UTC](https://community.sendbird.com/t/cannot-deauthenticate-sendbird-call/7709 "2023-06-28T11:19:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zdungx](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/zdungx/32/4018_2.png) [@zdungx](https://community.sendbird.com/u/zdungx)\
**Post date:** [June 28, 2023, 11:19am UTC](https://community.sendbird.com/t/cannot-deauthenticate-sendbird-call/7709/1 "2023-06-28T11:19:16Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![Chinmaya\_Gupta](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/chinmaya_gupta/32/1021_2.png) [@Chinmaya\_Gupta](https://community.sendbird.com/u/Chinmaya_Gupta)\
**Post date:** [June 29, 2023, 4:06am UTC](https://community.sendbird.com/t/cannot-deauthenticate-sendbird-call/7709/2 "2023-06-29T04:06:57Z")

</div>

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:

```auto
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.

---

<div class="post-metadata">

**Author:** ![zdungx](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/zdungx/32/4018_2.png) [@zdungx](https://community.sendbird.com/u/zdungx)\
**Post date:** [June 29, 2023, 7:46am UTC](https://community.sendbird.com/t/cannot-deauthenticate-sendbird-call/7709/3 "2023-06-29T07:46:34Z")

</div>

> [@Chinmaya\_Gupta](#):
>
> ou 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 co

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”,

---

<div class="post-metadata">

**Author:** ![Chinmaya\_Gupta](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/chinmaya_gupta/32/1021_2.png) [@Chinmaya\_Gupta](https://community.sendbird.com/u/Chinmaya_Gupta)\
**Post date:** [June 29, 2023, 8:05am UTC](https://community.sendbird.com/t/cannot-deauthenticate-sendbird-call/7709/4 "2023-06-29T08:05:01Z")

</div>

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:

```auto
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…

---

<div class="post-metadata">

**Author:** ![zdungx](https://sea2.discourse-cdn.com/flex020/user_avatar/community.sendbird.com/zdungx/32/4018_2.png) [@zdungx](https://community.sendbird.com/u/zdungx)\
**Post date:** [June 29, 2023, 8:12am UTC](https://community.sendbird.com/t/cannot-deauthenticate-sendbird-call/7709/5 "2023-06-29T08:12:25Z")

</div>

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.
