title: AWS Appsync 401 and 403 errors in React Native
body: <p>I've been pulling out my hair trying to set Appsync and Cognito in my React Native app. </p>
  
  <p>I've tried the two following ways:</p>
  
  <pre><code>Amplify.configure(config);
  
  OR
  
  Amplify.configure({
    Auth: {
      region: config.aws_cognito_region, // REQUIRED - Amazon Cognito Region
      userPoolId: config.aws_user_pools_id, // OPTIONAL - Amazon Cognito User Pool ID
      userPoolWebClientId: config.aws_user_pools_web_client_id, // User Pool App Client ID
    },
  });
  </code></pre>
  
  <p>AND</p>
  
  <pre><code>const client = new AWSAppSyncClient({
    url: appSyncConfig.graphqlEndpoint,
    region: appSyncConfig.region,
    auth: {
      type: appSyncConfig.authType,
      jwtToken: async () =&gt; (await Auth.currentSession()).getIdToken().getJwtToken(),
    },
  });
  
  OR
  
  const client = new AWSAppSyncClient({
    url: appSyncConfig.graphqlEndpoint,
    region: appSyncConfig.region,
    auth: {
      type: appSyncConfig.authType,
      apiKey: appSyncConfig.apiKey,
    },
  });
  </code></pre>
  
  <p>I've also followed these two tutorials <a href="https://hackernoon.com/tackling-user-authorization-in-graphql-with-aws-appsync-7886aef60b4a" rel="nofollow noreferrer">Tackling user auth</a>, <a href="https://aws.amazon.com/blogs/mobile/build-a-notes-app-with-react-native-aws-appsync-and-aws-amplify/" rel="nofollow noreferrer">Building a notes app</a>.</p>
  
  <p>In both cases, I get the following error in GraphQL with no description:</p>
  
  <p><code>Error: Network error: Response not successful: Received status code</code></p>
  
  <p>This is while in Authorization Type is <code>Amazon Cognito User Pool</code>. I've also tried <code>AWS Identity and Access Management (IAM)</code>, but that gives me a 403 error. Can someone point me in a direction where I can debug this further? </p>