2回答
- 新しい順
- 投票が多い順
- コメントが多い順
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
},
}
});
回答済み 2ヶ月前
関連するコンテンツ
- 質問済み 3年前
- AWS公式更新しました 1年前
- AWS公式更新しました 2年前
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: