[Vuejs]-How to allow a user to choose a Group Pool on sign-up in VueJS with AWS Amplify?

0👍

You can do it with custom attributes, where they’re all in one "group" in cognito, but have a custom attribute custom:group, that will allow you to mediate the group the user is in.

Auth.signUp({
    username,
    password,
    attributes: {
        email,
        'custom:group': 'Teacher'  // custom attribute, not standard
    }
});

You can then use a Lambda Post Confirmation trigger to send the user’s information to the correct DynamoDB table to manage their profile:

  let params = {
    Item: {...},
    TableName:
      event.request.userAttributes["custom:group"] === "Teacher"
        ? process.env...[TABLE_TEACHER]
        : process.env...[TABLE_STUDENTS],
  };

Leave a comment