aws-cdk-lib.aws_cognito.CustomAttributeProps

interface CustomAttributeProps

LanguageType name
.NETAmazon.CDK.AWS.Cognito.CustomAttributeProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscognito#CustomAttributeProps
Javasoftware.amazon.awscdk.services.cognito.CustomAttributeProps
Pythonaws_cdk.aws_cognito.CustomAttributeProps
TypeScript (source)aws-cdk-lib » aws_cognito » CustomAttributeProps

Constraints that can be applied to a custom attribute of any type.

Example

new cognito.UserPool(this, 'myuserpool', {
  // ...
  standardAttributes: {
    fullname: {
      required: true,
      mutable: false,
    },
    address: {
      required: false,
      mutable: true,
    },
  },
  customAttributes: {
    'myappid': new cognito.StringAttribute({ minLen: 5, maxLen: 15, mutable: false }),
    'callingcode': new cognito.NumberAttribute({ min: 1, max: 3, mutable: true }),
    'isEmployee': new cognito.BooleanAttribute({ mutable: true }),
    'joinedOn': new cognito.DateTimeAttribute(),
  },
});

Properties

NameTypeDescription
mutable?booleanSpecifies whether the value of the attribute can be changed.

mutable?

Type: boolean (optional, default: false)

Specifies whether the value of the attribute can be changed.

For any user pool attribute that's mapped to an identity provider attribute, you must set this parameter to true. Amazon Cognito updates mapped attributes when users sign in to your application through an identity provider. If an attribute is immutable, Amazon Cognito throws an error when it attempts to update the attribute.