Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can "Attribute verification and user account confirmation" in AWS Cognito be setup programmatically in Amplify? #12871

Closed
maziarzamani opened this issue Jun 27, 2023 · 5 comments
Labels
pending-response Issue is pending response from the issue author pending-triage Issue is pending triage question General question

Comments

@maziarzamani
Copy link

Amplify CLI Version

12.0.0

Question

Hi all.

I was wondering if there is any way to set the "Attribute verification and user account confirmation" programmatically, or do I need to do this manually in the console?

Thanks!

Skærmbillede 2023-06-27 kl  10 43 22
@maziarzamani maziarzamani added pending-triage Issue is pending triage question General question labels Jun 27, 2023
@biller-aivy
Copy link

Add a preSignUp Cognito Trigger with the cli and add this:

/* Amplify Params - DO NOT EDIT
	ENV
	REGION
Amplify Params - DO NOT EDIT */ /* eslint-disable-line */

exports.handler = async (event, context, callback) => {
  console.log('event', event);
  if (event.request.clientMetadata && event.request.clientMetadata.autoConfirmUser) {
    // Confirm the user
    event.response.autoConfirmUser = true;
  }

  // Set the email as verified if it is in the request
  if (
    event.request.clientMetadata &&
    event.request.clientMetadata.autoVerifyEmail &&
    event.request.userAttributes.hasOwnProperty('email')
  ) {
    event.response.autoVerifyEmail = true;
  }

  // Set the phone number as verified if it is in the request
  if (event.request.userAttributes.hasOwnProperty('phone_number')) {
    event.response.autoVerifyPhone = false;
  }

  // Return to Amazon Cognito
  callback(null, event);
};

@josefaidt
Copy link
Contributor

Hey @maziarzamani 👋 thanks for raising this, and thank you @biller-aivy for jumping in here. @maziarzamani does the above example answer your question?

@josefaidt josefaidt added the pending-response Issue is pending response from the issue author label Jun 29, 2023
@josefaidt
Copy link
Contributor

Hey @maziarzamani just wanted to check in here. Are you still experiencing this?

@josefaidt
Copy link
Contributor

Closing due to inactivity

@josefaidt josefaidt closed this as not planned Won't fix, can't repro, duplicate, stale Aug 14, 2023
@github-actions
Copy link

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pending-response Issue is pending response from the issue author pending-triage Issue is pending triage question General question
Projects
None yet
Development

No branches or pull requests

3 participants