title: How to integrate AWS Cognito Identity Pool and API Gateway in the Javascript sdk
body: <p>I want to protect access to API Gateway using Cognito Identiy Pool (to which for now I authorize using Cognito User Pools, but later I may user other providers like facebook etc.)</p>
  
  <p>So from the documentation <a href="http://docs.aws.amazon.com/cognito/latest/developerguide/using-amazon-cognito-user-identity-pools-javascript-examples.html" rel="nofollow noreferrer">here</a></p>
  
  <pre><code>AWS.config.credentials = new AWS.CognitoIdentityCredentials({
    IdentityPoolId: 'YOUR_IDENTITY_POOL_ID',
    Logins: {
      'cognito-idp.&lt;region&gt;.amazonaws.com/&lt;YOUR_USER_POOL_ID&gt;': 'some-user-pool-token'
    }
  });
  AWS.config.credentials.refresh((error) =&gt; {
      ...
  }
  </code></pre>
  
  <p>But to use API Gateway (from an generated sdk) I need:</p>
  
  <pre><code>accessKey: 'ACCESS_KEY',
  secretKey: 'SECRET_KEY'
  </code></pre>
  
  <p>My questions:</p>
  
  <ol>
  <li>How do I get the ACCES_KEY and SECRET_KEY?</li>
  <li>The only reason I need a dependency to the aws sdk is, that I need to call <code>credentials.refresh</code>. Can I somehow do this withpout the aws sdk (and only the amazon-cognito-identity-js as well as the generated api gateway sdk)?</li>
  </ol>