Amplify-js: PreSign Up trigger with autoConfirm user does not seem to work with Authenticator component

Created on 7 Apr 2020  路  5Comments  路  Source: aws-amplify/amplify-js

With the authenticator component, if I use the pre SignUp trigger to autoconfirm user, I am still able to see the confirmation code prompt, though I do not receive any verification email.
When I enter a garbage value it gives me an error message as follows:

User cannot be confirmed. Current status is CONFIRMED

I tried searching in git issues, though not able to find anything there on this behavior.
Closest was this:
https://github.com/aws-amplify/amplify-js/issues/2588

below is a simple lambda trigger I am testing with:

import json

def lambda_handler(event, context):
    event['response']['autoConfirmUser'] = True
    return event

I am able to see that the user comes out as CONFIRMED, though not able to understand how to remove the confirmation prompt.

Sample screenshot of the behavior here:
https://ibb.co/F06GQTJ

Amplify UI Components UI feature-request

Most helpful comment

@jordanranz can you let us know what the built-in workaround is?

All 5 comments

@vchaddha can you provide a code snippet of your Authenticator component? Thanks ahead of time

Below is the component that I am using for auth

<amplify-authenticator [signUpConfig]="signUpConfig" [hide]="['Greetings']"></amplify-authenticator>

Below is the signUpConfig

signUpFields: [
      {
        label: 'Username',
        key: 'username',
        required: true,
        displayOrder: 1,
        type: 'string'
      },
      {
        label: 'Password',
        key: 'password',
        required: true,
        displayOrder: 2,
        type: 'password'
      },
      { 
        key: 'custom:name',
        label: 'Hospital Name',
        displayOrder: 3,
        required: true,
        type: 'string'
      },
      {
        label: 'Zip Code',
        key: 'custom:zipcode',
        required: true,
        displayOrder: 4,
        type: 'string'
      },
      {
        label: 'Email',
        key: 'email',
        required: true,
        displayOrder: 5,
        type: 'string'
      },
      {
        label: 'Phone Number',
        key: 'phone_number',
        required: true,
        displayOrder: 6,
        type: 'string'
      }
    ]
  };

Was able to speak offline about this and find a built-in workaround. Going to build better handling into the new UI components.

Hey there, we have simillar issue. We are autoConfirming the users, but still want to send them an email with code, to verify their email address. When we pass the autoConfirm flag to true, it does not send them an email. We want to actually verify the email by sending them the code, because we can't just "trust" them and autoverify the emails too. I tried to use resendConfirmationCodeAsync, but it returns me an error, that the user is already verified. Any ideas on how to do this, or any workaround?

@jordanranz can you let us know what the built-in workaround is?

Was this page helpful?
0 / 5 - 0 ratings