question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

PreSign Up trigger with autoConfirm user does not seem to work with Authenticator component

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

5reactions
GeorgeBellTMHcommented, May 16, 2020

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

0reactions
ErikCHcommented, Nov 4, 2021

The updates in the new authenticator are now merged and in place. If you’re using a PreSign up lambda trigger to auto confirm users, the authenticator will detect this and now skip the confirm verify page.

Please note, that if the user is confirmed, but their email is NOT confirmed, the next time they sign in they will be asked if they’d like to confirm their email. They don’t have to confirm their email, they will still have an option to skip at the bottom of the page.

If you’d like a user to never confirm their email, then you’ll need to setup the lambda trigger to confirm the email as well as the user. Like this.

 exports.handler = async (event, context, callback) => {
    // Confirm the user
    event.response.autoConfirmUser = true;
    // Set the email as verified if it is in the request
    if (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 = true;
    }
    callback(null, event);
  };

I’ll close this issue, but feel free to create another one if this doesn’t work for you.

Here is the documentation to get started if you’d like to try this out

https://ui.docs.amplify.aws/ui/getting-started/installation

Read more comments on GitHub >

github_iconTop Results From Across the Web

Pre sign-up Lambda trigger
Pre sign-up example: Auto-confirm users from a registered domain. You can use the pre sign-up Lambda trigger to add custom logic that validates...
Read more >
Pre Sign-up Lambda Trigger autoConfirmUser not working
Using Pre Sign-up trigger you can only set email/phone to verified or user status to CONFIRMED . Password change will be required in...
Read more >
Advanced workflows - Lambda Triggers - AWS Amplify Docs
The following is an example of how to configure the aws-amplify-vue authenticator components so that your app displays a message telling the user...
Read more >
AWS Amplify: Adding a user to a group programmatically
On your React component's render function, drop in the Authenticator component. Here we are requiring a custom attribute "Manager ID" which will ......
Read more >
Automatically fill in verification codes on iPhone
If prompted, select the option to use an authenticator app. When asked for a verification code, tap the suggestion that appears above the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found