title: API Gateway - Custom Lambda Authorizer, Validate passed header value (username) exists in Cognito User pool group
body: <p>I'm trying to make a custom authorizer in API Gateway that uses a lambda function to check if the user's email (passed in their request) to us, is a valid email (being valid, I mean a user that we have in our Cognito user pool/group) and is in a specific Cognito user pool, and then the specific Cognito user group that they are in.</p>
  <p>I see that there are two different types of Lambda Authorizers that I can make, either <em><strong>Token</strong></em> or <em><strong>Request</strong></em>, I sort of think either are valid uses for this?
  Because in the end I need to be able to specify the header the client is going to send and check that key's value to see if the username passed is in Cogntio.</p>
  <p>Example,</p>
  <pre><code>User tries to query endpoint petstore.com/getDogs
  user passes header: username: test@gmail.com
  </code></pre>
  <p>API Gateway custom lambda auth checks the header <code>username</code>, gets the value <code>test@gmail.com</code> and then verifies that it does or doesn't exist in a specific Cognito user pool/group.</p>