title: React Native Logout Using Access Token Error
body: <p>This is a simple app to login with API and logout. I retrieved Access Token when login. I navigated the access token to sidebar and trying to log out using logout function</p>
  <p>SideBar.js</p>
  <pre><code>import React from 'react';
  import { Text, Alert } from 'react-native';
  import { Drawer,Container, Content, Header, Right, Button } from 'native-base';
  
  export default class SideBar extends React.Component {
  constructor(props) {
  
      super(props)
  
      this.state = {
  
          token: this.props.usertoken
  
      }
  
  }
  
  UserLogoutFunction = () =&gt;{
  
      const { token }  = this.state;
      
      
      fetch('https://api.idepoz.com/ncl/api/logout', {
      method: 'POST',
      headers: {
          'Accept': 'application/json',
          'Authorization': `Bearer ${token}`,
      },
      body: JSON.stringify({
      
          
      })
      
      }).then((response) =&gt; response.json())
          .then((responseJson) =&gt; {
              console.log(&quot;token&quot;);
              if(responseJson)
              {
                 
                  this.props.navigation.navigate('Login');
                  Alert.alert(&quot;Succesfully Logged Out&quot;);
              }
              else{
      
                  Alert.alert(responseJson);
              }
      
          }).catch((error) =&gt; {
              console.error(error);
          });
  
  }
  render() {
      return (
          &lt;Container&gt;
              &lt;Header&gt;
              &lt;/Header&gt;
              &lt;Content&gt;
              
              &lt;Button transparent onPress={ this.UserLogoutFunction } &gt;
                  &lt;Text style={{fontSize: 24}}&gt;Log Out&lt;/Text&gt;       
              &lt;/Button&gt;  
              &lt;/Content&gt;
          &lt;/Container&gt;
      );
      }
      }
  </code></pre>
  <p>It returning NETWORK REQUEST FAILED.</p>
  <p>The below function returned access token while login</p>
  <pre><code>UserLoginFunction = () =&gt;{
  
      const { UserName }  = this.state ;
      const { UserPassword }  = this.state ;
      
      
      fetch('https://api.idepoz.com/ncl/api/login', {
      method: 'POST',
      headers: {
          'Accept': 'application/json',
          'Content-Type': 'application/json',
      },
      body: JSON.stringify({
      
          username: UserName,
      
          password: UserPassword
      
      })
      
      }).then((response) =&gt; response.json())
          .then((responseJson) =&gt; {
              
              if(responseJson)
              {
                  
                  this.props.navigation.navigate('QrScan',{usertoken:responseJson.token});
              }
              else{
      
                  Alert.alert(responseJson);
              }
      
          }).catch((error) =&gt; {
              console.error(error);
          });
  
          }
  </code></pre>
  <p>Please tell what's wrong with the &quot;UserLogoutFunction&quot;</p>
  <p><a href="https://i.stack.imgur.com/Wynj1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Wynj1.png" alt="enter image description here" /></a></p>