You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
User attributes are defined as [Cognito Standard Attributes](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#cognito-user-pools-standard-attributes). Attributes can be configured to be _required_ for user sign-up in addition to whether the values are _mutable_. When configuring your resource to allow your users to login with `email`, an email must be specified for user sign-up and cannot be changed later. However additional attributes can be configured to be optional, and mutable after sign-up.
65
65
66
+
```ts title="amplify/auth/resource.ts"
67
+
import { defineAuth } from"@aws-amplify/backend";
68
+
69
+
exportconst auth =defineAuth({
70
+
loginWith: {
71
+
email: true,
72
+
},
73
+
userAttributes: {
74
+
// Maps to Cognito standard attribute 'address'
75
+
address: {
76
+
mutable: true,
77
+
required: true,
78
+
},
79
+
// Maps to Cognito standard attribute 'birthdate'
80
+
birthdate: {
81
+
mutable: true,
82
+
required: false,
83
+
},
84
+
// Maps to Cognito standard attribute 'email'
85
+
email: {
86
+
mutable: true,
87
+
required: true,
88
+
},
89
+
// Maps to Cognito standard attribute 'family_name'
90
+
familyName: {
91
+
mutable: true,
92
+
required: false,
93
+
},
94
+
// Maps to Cognito standard attribute 'gender'
95
+
gender: {
96
+
mutable: true,
97
+
required: false,
98
+
},
99
+
// Maps to Cognito standard attribute 'given_name'
100
+
givenName: {
101
+
mutable: true,
102
+
required: false,
103
+
},
104
+
// Maps to Cognito standard attribute 'locale'
105
+
locale: {
106
+
mutable: true,
107
+
required: false,
108
+
},
109
+
// Maps to Cognito standard attribute 'middle_name'
110
+
middleName: {
111
+
mutable: true,
112
+
required: false,
113
+
},
114
+
// Maps to Cognito standard attribute 'name'
115
+
fullname: {
116
+
mutable: true,
117
+
required: false,
118
+
},
119
+
// Maps to Cognito standard attribute 'nickname'
120
+
nickname: {
121
+
mutable: true,
122
+
required: false,
123
+
},
124
+
// Maps to Cognito standard attribute 'phone_number'
125
+
phoneNumber: {
126
+
mutable: true,
127
+
required: false,
128
+
},
129
+
// Maps to Cognito standard attribute 'picture'
130
+
profilePicture: {
131
+
mutable: true,
132
+
required: false,
133
+
},
134
+
// Maps to Cognito standard attribute 'preferred_username'
135
+
preferredUsername: {
136
+
mutable: true,
137
+
required: false,
138
+
},
139
+
// Maps to Cognito standard attribute 'profile'
140
+
profilePage: {
141
+
mutable: true,
142
+
required: false,
143
+
},
144
+
// Maps to Cognito standard attribute 'zoneinfo'
145
+
timezone: {
146
+
mutable: true,
147
+
required: false,
148
+
},
149
+
// Maps to Cognito standard attribute 'updated_at'
150
+
lastUpdateTime: {
151
+
mutable: true,
152
+
required: false,
153
+
},
154
+
// Maps to Cognito standard attribute 'website'
155
+
website: {
156
+
mutable: true,
157
+
required: false,
158
+
},
159
+
},
160
+
});
161
+
```
162
+
66
163
## Custom attributes
67
164
68
165
In addition to the provided standard attributes, you can configure [Custom Attributes](https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-settings-attributes.html#user-pool-settings-custom-attributes). These are attributes that are typically unique to your use case, such as a tenant ID or a user's display name. Custom attributes are identified by the `custom:` prefix:
0 commit comments