title: How to create Cognito IdentityPool with Cognito UserPool as one of the Authentication provider using aws cdk?
body: <p>I am trying to create a Cognito FederatedIdentityPool with CognitoUserPool as one Authentication Provider. Creating UserPool was easy enough:</p>
  
  <pre class="lang-js prettyprint-override"><code>    const userPool = new cognito.CfnUserPool(this, 'MyCognitoUserPool')
      const userPoolClient = new cognito.CfnUserPoolClient(this, 'RandomQuoteUserPoolClient', {
        generateSecret: false,
        userPoolId: userPool.userPoolId
      });
  </code></pre>
  
  <p>However I am not sure how to connect this to an Identity Pool:</p>
  
  <pre class="lang-js prettyprint-override"><code>    const identityPool = new cognito.CfnIdentityPool(this, 'MyIdentityPool', {
        allowUnauthenticatedIdentities: false,
        cognitoIdentityProviders: ?????
      });
  </code></pre>
  
  <p>Based on <a href="https://awslabs.github.io/aws-cdk/refs/_aws-cdk_aws-cognito.html#@aws-cdk/aws-cognito.CfnIdentityPoolProps.cognitoIdentityProviders" rel="noreferrer">IdentityProvider API Documentation</a> it looks like there is a propert <code>cognitoIdentityProviders</code>, however it accepts an array of <code>cdk.Token/CognitoIdentityProviderProperty</code>.</p>
  
  <p>Now I tried creating a <a href="https://awslabs.github.io/aws-cdk/refs/_aws-cdk_aws-cognito.html#@aws-cdk/aws-cognito.CfnIdentityPool.CognitoIdentityProviderProperty" rel="noreferrer">CognitoIdentityProviderProperty</a> object and pass it <code>cognitoIdentityProviders: [{ clientId: userPoolClient.userPoolClientId }]</code>, but I am getting following exception:</p>
  
  <pre><code> 1/2 | 09:48:35 | CREATE_FAILED        | AWS::Cognito::IdentityPool   | RandomQuoteIdentityPool Invalid Cognito Identity Provider (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: InvalidParameterException; Request ID: 4d6d579a-6455-11e9-99a9-85159bc87779)
          new CdkWorkshopStack (/Users/cdk/lib/cdk-workshop-stack.ts:46:26)
          \_ Object.&lt;anonymous&gt; (/Users/cdk/bin/cdk-workshop.ts:7:1)
          \_ Module._compile (module.js:653:30)
          \_ Object.Module._extensions..js (module.js:664:10)
          \_ Module.load (module.js:566:32)
          \_ tryModuleLoad (module.js:506:12)
          \_ Function.Module._load (module.js:498:3)
          \_ Function.Module.runMain (module.js:694:10)
          \_ startup (bootstrap_node.js:204:16)
          \_ bootstrap_node.js:625:3
  </code></pre>
  
  <p>I even tried copying id from AWS Console and hardcoding it here, still same error.</p>
  
  <ol>
  <li>Can someone please help me in explaining how can I configure Authentication Providers in <code>CfnIdentityPool</code>.</li>
  <li>Why is there a <a href="https://awslabs.github.io/aws-cdk/refs/_aws-cdk_aws-cognito.html#userpool" rel="noreferrer">UserPool</a> and <a href="https://awslabs.github.io/aws-cdk/refs/_aws-cdk_aws-cognito.html#cfnuserpooluser" rel="noreferrer">CfnUserPool</a>? What is difference between them and which one is supposed to be used?</li>
  </ol>