How do I use Cognito with the generated Javascript SDK? : <p>I couldn't find any documentation that showed how to do this so I tried my best to figure it out (is this not a common use case)? I've set up my resource to use IAM authentication, set up CORS, etc. Then I deployed it, and downloaded the generated the SDK.</p>

<p>On the client-side I'm using the credentials from AWS.CognitoIdentityCredentials with apigClientFactory.newClient. When I try to post to my resource, I get a 403 error response with no body. </p>

<p>The response headers contain: <code>x-amz-ErrorType: UnrecognizedClientException</code></p>

<p>Could this error possibly be coming from some other AWS service (do they bubble up like that)? If so, how can I tell which one? What else might be causing the error?</p>

<p>The code I'm using test test client-side looks like this:</p>



<pre><code>function onFacebookLogin(fbtoken) {
  // get cognito credentials
  AWS.config.credentials = new AWS.CognitoIdentityCredentials({
    IdentityPoolId: 'us-east-1:abcd6789-1234-567a-b123-12ab34cd56ef',
    Logins: {'graph.facebook.com': fbtoken}
  });
  AWS.config.credentials.get(function(err) {
    if (err) {return console.error('Credentials error: ', err);}

    /* I'm assuming that this is what I use for accessKey and secretKey */
    var credentials = AWS.config.credentials;
    apigClient = apigClientFactory.newClient({
      accessKey: credentials.accessKeyId,
      secretKey: credentials.secretAccessKey
    });
  });
}
</code></pre>
