Skip to content

Add Custom Attributes

cognitoidentityprovider_add_custom_attributes R Documentation

Adds additional user attributes to the user pool schema

Description

Adds additional user attributes to the user pool schema. Custom attributes can be mutable or immutable and have a ⁠custom:⁠ or ⁠dev:⁠ prefix. For more information, see Custom attributes.

You can also create custom attributes in the Schema parameter of create_user_pool and update_user_pool. You can't delete custom attributes after you create them.

Amazon Cognito evaluates Identity and Access Management (IAM) policies in requests for this API operation. For this operation, you must use IAM credentials to authorize requests, and you must grant yourself the corresponding IAM permission in a policy.

Learn more

Usage

cognitoidentityprovider_add_custom_attributes(UserPoolId,
  CustomAttributes)

Arguments

UserPoolId

[required] The ID of the user pool where you want to add custom attributes.

CustomAttributes

[required] An array of custom attribute names and other properties. Sets the following characteristics:

AttributeDataType

The expected data type. Can be a string, a number, a date and time, or a boolean.

Mutable

If true, you can grant app clients write access to the attribute value. If false, the attribute value can only be set up on sign-up or administrator creation of users.

Name

The attribute name. For an attribute like custom:myAttribute, enter myAttribute for this field.

Required

When true, users who sign up or are created must set a value for the attribute.

NumberAttributeConstraints

The minimum and maximum length of accepted values for a Number-type attribute.

StringAttributeConstraints

The minimum and maximum length of accepted values for a String-type attribute.

DeveloperOnlyAttribute

This legacy option creates an attribute with a ⁠dev:⁠ prefix. You can only set the value of a developer-only attribute with administrative IAM credentials.

Value

An empty list.

Request syntax

svc$add_custom_attributes(
  UserPoolId = "string",
  CustomAttributes = list(
    list(
      Name = "string",
      AttributeDataType = "String"|"Number"|"DateTime"|"Boolean",
      DeveloperOnlyAttribute = TRUE|FALSE,
      Mutable = TRUE|FALSE,
      Required = TRUE|FALSE,
      NumberAttributeConstraints = list(
        MinValue = "string",
        MaxValue = "string"
      ),
      StringAttributeConstraints = list(
        MinLength = "string",
        MaxLength = "string"
      )
    )
  )
)