# UserPoolDomainProps

Props for UserPoolDomain construct.

Extends: UserPoolDomainProps
Extends: UserPoolDomainOptions
Used as props by: UserPoolDomain

- Source: [`aws-cognito/lib/user-pool-domain.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-cognito/lib/user-pool-domain.ts#L103)
- Type last changed: v2.235.0 · 15 Jan 2026

## Example

```ts
import { aws_certificatemanager as acm } from 'aws-cdk-lib';

declare const vpc: ec2.Vpc;
declare const certificate: acm.Certificate;

const lb = new elbv2.ApplicationLoadBalancer(this, 'LB', {
  vpc,
  internetFacing: true,
});

const userPool = new cognito.UserPool(this, 'UserPool');
const userPoolClient = new cognito.UserPoolClient(this, 'Client', {
  userPool,

  // Required minimal configuration for use with an ELB
  generateSecret: true,
  authFlows: {
    userPassword: true,
  },
  oAuth: {
    flows: {
      authorizationCodeGrant: true,
    },
    scopes: [cognito.OAuthScope.EMAIL],
    callbackUrls: [
      `https://${lb.loadBalancerDnsName}/oauth2/idpresponse`,
    ],
  },
});
const cfnClient = userPoolClient.node.defaultChild as cognito.CfnUserPoolClient;
cfnClient.addPropertyOverride('RefreshTokenValidity', 1);
cfnClient.addPropertyOverride('SupportedIdentityProviders', ['COGNITO']);

const userPoolDomain = new cognito.UserPoolDomain(this, 'Domain', {
  userPool,
  cognitoDomain: {
    domainPrefix: 'test-cdk-prefix',
  },
});

lb.addListener('Listener', {
  port: 443,
  certificates: [certificate],
  defaultAction: new actions.AuthenticateCognitoAction({
    userPool,
    userPoolClient,
    userPoolDomain,
    next: elbv2.ListenerAction.fixedResponse(200, {
      contentType: 'text/plain',
      messageBody: 'Authenticated',
    }),
  }),
});

new CfnOutput(this, 'DNS', {
  value: lb.loadBalancerDnsName,
});
```

## Properties

- `cognitoDomain`: [CognitoDomainOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.CognitoDomainOptions.html) — Associate a cognito prefix domain with your user pool Either `customDomain` or `cognitoDomain` must be specified.

  **Default:** not set if `customDomain` is specified, otherwise, throws an error.

- `customDomain`: [CustomDomainOptions](/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.CustomDomainOptions.html) — Associate a custom domain with your user pool Either `customDomain` or `cognitoDomain` must be specified.

  **Default:** not set if `cognitoDomain` is specified, otherwise, throws an error.

- `managedLoginVersion`: [ManagedLoginVersion](/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.ManagedLoginVersion.html) — A version that indicates the state of managed login.

  **Default:** undefined - Cognito default setting is ManagedLoginVersion.CLASSIC_HOSTED_UI

  This choice applies to all app clients that host services at the domain.

- `userPool`: [IUserPoolRef](/cdk/api/v2/docs/aws-cdk-lib.interfaces.aws_cognito.IUserPoolRef.html) (required) — The user pool to which this domain should be associated.
