skip to Main Content

I created a user pool in AWS’s Cognito, specified given_name and family_name as required user attributes. I also added an app and checked the permissions :

attribute permissions for app

If – using the Cognito Identidy SDK – I try to register a user and omit the attributes, I get: "Attributes did not conform to the schema: given_name: The attribute is required family_name: The attribute is required" which is expected.

If I include the attributes:

const firstNameAttribute = new CognitoUserAttribute({ Name: 'first_name', Value: firstName });
const lastNameAttribute = new CognitoUserAttribute({ Name: 'last_name', Value: lastName });
cognitoUserPool.signUp(username, password, [firstNameAttribute], [lastNameAttribute], callback);

The server returns

{
    "__type":"NotAuthorizedException",
    "message":"A client attempted to write unauthorized attribute"
}

How can I fix this and let users set their name during registration?

2

Answers


  1. Chosen as BEST ANSWER

    The app in which the users would try register sent the wrong field names :(


  2. You have to check Write permission is allowed in app client.

    Location:

    Amazon Cognito > User Pools > {User Pool} > App Integration > App
    Client > Attribute read and write permissions > Edit

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search