title: CDK How to use the default generated Cloudfront Distribution URL in Cognito Callback URL?
body: <p>I'm setting up a CloudFront distribution to a static hosted website in S3. For authentication I'm using the Cognito user pool hosted UI for authentication. I want to use the CloudFront Distribution domain name and assign it to the Cognito Callback URL for login. However I'm unable to use the CloudFront Distribution Domain Name that is randomly generated and associate it to the Callback URL since it is instantiated at creation. The only work around I can see is creating
  a certificate for the CloudFront distribution. This does not work for me since my solution is required to use the CloudFront Distribution Domain Name. How would you solve this issue? Here is my code:</p>
  <pre><code>   cd = cloudfront.Distribution(self, &quot;myDist&quot;,
          default_root_object='index.html',
          default_behavior=cloudfront.BehaviorOptions(
              origin=origins.S3Origin(website_bucket, origin_access_identity=oai), 
              viewer_protocol_policy=cloudfront.ViewerProtocolPolicy.REDIRECT_TO_HTTPS)
      )
  
      pool = cognito.UserPool(self, 
      &quot;pool&quot;,
      user_invitation=cognito.UserInvitationConfig(
          email_subject=&quot;Invite to join our awesome app!&quot;,
          email_body=&quot;Hello {username}, you have been invited to join our awesome app! Your temporary password is {####}&quot;,
          sms_message=&quot;Hello {username}, your temporary password for our awesome app is {####}&quot;
      ),
      mfa=cognito.Mfa.REQUIRED,
      mfa_second_factor=cognito.MfaSecondFactor(
          sms=True,
          otp=True
      ),
      sign_in_aliases=cognito.SignInAliases(
              username=True,
              email=True
          )
      )
  
      pool.add_client(&quot;app-client&quot;,
      o_auth=cognito.OAuthSettings(
          flows=cognito.OAuthFlows(
              authorization_code_grant=True,
              implicit_code_grant=True
          ),
          scopes=[cognito.OAuthScope.OPENID],
          callback_urls=[str(cd.domain_name)],
          logout_urls=[&quot;https://my-app-domain.com/signin&quot;]
          )
      )
  </code></pre>