title: How do I authenticate against an AWS Cognito User Pool
body: <p>I've created a Cognito User Pool.  I can list the users and add the users using the AWSCognitoIdentityProviderClient from the Java AWS SDK.</p>
  
  <p>However, I have a custom login page and I wish to take the entered username and password and authenticate against my User Pool.  I don't see anywhere in the Java AWS SDK where I can pass credentials and get an authentication result from.</p>
  
  <p>Edit: I can't get past this error:</p>
  
  <p>NotAuthorizedException: Missing credentials in config</p>
  
  <p>Relevant code:</p>
  
  <pre><code>    AWS.config.region = 'us-east-1';
      AWS.config.credentials = new AWS.CognitoIdentityCredentials({
          IdentityPoolId: 'us-east-1:087a3210-64f8-4dae-9e3c...' // your identity pool id here
      });
  
      AWSCognito.config.region = 'us-east-1';
      AWSCognito.config.credentials = new AWS.CognitoIdentityCredentials({
          IdentityPoolId: 'us-east-1:087a3210-64f8-4dae-9e3c...' // your identity pool id here
      });
  
      var poolData = {
          UserPoolId: 'us-east-1_39RP...',
          ClientId: 'ttsj9j5...',
          ClientSecret: 'bkvkj9r8kl2ujrlu41c7krsb6r7nub2kb260gj3mgi...'
      };
      var userPool = new AWSCognito.CognitoIdentityServiceProvider.CognitoUserPool(poolData);
  
      var authenticationData = {
          Username: 'test@foo.com',
          Password: 'foobarfoo',
      };
      var authenticationDetails = new AWSCognito.CognitoIdentityServiceProvider.AuthenticationDetails(authenticationData);
      var userData = {
          Username: 'test@foo.com',
          Pool: userPool
      };
      var cognitoUser = new AWSCognito.CognitoIdentityServiceProvider.CognitoUser(userData);
      cognitoUser.authenticateUser(authenticationDetails, {
          onSuccess: function (result) {
              console.log('access token + ' + result.getAccessToken().getJwtToken());
          },
  
          onFailure: function (err) {
              alert(err);
          },
  
      });
  </code></pre>