Skip to content
v2.273.0

StandardAttribute Struct ​

Standard attribute that can be marked as required or mutable.

Example ​

ts
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 ​

mutablebooleanmutableboolmutableBooleanMutableboolMutable*bool= true#
Specifies whether the value of the attribute can be changed.
notes

For any user pool attribute that's mapped to an identity provider attribute, this must be set 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.

requiredbooleanrequiredboolrequiredBooleanRequiredboolRequired*bool= false#
Specifies whether the attribute is required upon user registration.

If the attribute is required and the user does not provide a value, registration or sign-in will fail.