2 Answers
- Newest
- Most votes
- Most comments
0
The problem arises from the fact that fullname
is not recognized as a valid userAttribute
. This is because AWS follows the standard set by the OpenID Connect specification, which assigns all users a predefined set of attributes.
The standard attributes available for Amplify are:
- address
- birthdate
- family_name
- gender
- given_name
- locale
- middle_name
- name
- nickname
- phone_number
- picture
- preferred_username
- profile
- sub
- updated_at
- website
- zoneinfo
0
So, even if 'name' is part of OpenID specs and doesn't work for unknown reason, for now I'll use given name and family name, like below, instead:
import {defineAuth} from '@aws-amplify/backend';
export const auth = defineAuth({
loginWith: {
email: true
},
userAttributes: {
// require the attribute be provided during sign-up
givenName: { // Given name or first name
required: true,
mutable: true
},
familyName: {
required: true,
mutable: true
},
}
});
answered 2 months ago
Relevant content
- Accepted Answerasked 2 years ago
- asked 3 months ago
- Accepted Answerasked a year ago
- Accepted Answerasked 2 months ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 2 years ago
Ok then I try with 'name' in amplify/auth/resource.ts and I've got error "'name' does not exist in type 'StandardAttributes'":
userAttributes: { // require the attribute be provided during sign-up name: { required: true, mutable: true }, }
and if if I try
npx amplify sandbox
, error "TypeScript validation check failed, check your backend definition"Also I know you wanted to use an attribute called "fullname", but the backend authentication resource authored using
defineAuth
does not currently support adding custom attributes. If you wish to add custom attributes you will need to define them using overrides.That weird, I was checking the documentation for Amplify Gen 2, name exists in the type StandardAttribute. Let's try this:
can you share your
amplify/auth/resource.ts
?And as you mentionned before 'name' is part of OpenID Connect specification.
I don't want fullName.. I just want 'name', I've only tried with fullName because name alone was causing touble, but my goal here is simply to have name.
Here is my amplify/auth/resource.ts: