Skip to content

Cognito Hosted UI: How can users confirm their accounts on their own with code after close "Confirm your account" page?

0

Hello! I'm using Cognito Hosted UI to manage users in my app.

I noticed that after a user registers in the User Pool and, for some reason, doesn't enter the confirmation code and closes the page at https://<userPoolId>.auth.us-east-1.amazoncognito.com/signup/confirm, there's no simple way to show this page again.

After trying to log in, the user sees the message "User is not confirmed" and isn't redirected to the "Confirm your account" page. It confuses them, as they don't know what to do next.

I tried using the Pre Authentication Lambda trigger. With it, I can send a new code, but I still can't redirect the user to the page where they can enter the code.

I also tried switching the Verification type to "Link." But how can I let the user know that I've sent a new confirmation email?

I'm curious if there's a way to show the confirmation page to the user again without leaving Cognito Hosted UI?

I'd appreciate any help.

asked a year ago220 views
1 Answer
-1

Unfortunately, there isn't a built-in way within the Cognito Hosted UI to automatically redirect users back to the confirmation page if they close it before confirming their account. However, there are a few approaches you can consider to address this issue:

  1. Custom Error Page: You can create a custom error page for the "User is not confirmed" message. In this page, you can provide clear instructions on how to confirm the account, including steps to check their email for the confirmation code or request a new one.

  2. Resend Confirmation Code: You can implement a "Resend confirmation code" functionality in your application. This would use the ConfirmSignUp API to send a new confirmation code to the user's email or phone number. You can then guide the user to enter this code in your application.

  3. Auto-Confirmation: If appropriate for your use case, you can use a Pre Sign-up Lambda trigger to automatically confirm users from specific domains or based on certain criteria. This would bypass the need for manual confirmation entirely.

  4. Custom UI Flow: While not strictly within the Hosted UI, you could implement a custom sign-up flow in your application that handles the confirmation process more smoothly. This would give you more control over the user experience but requires more development effort.

  5. Verification Type as Link: If you switch to using a link for verification, you could implement a system to resend the verification email when a user attempts to log in and is found to be unconfirmed. You could then display a message informing the user that a new confirmation email has been sent.

Each of these approaches has its trade-offs in terms of user experience, security, and development effort. The best solution will depend on your specific requirements and constraints. Remember that any changes to the authentication flow should be carefully considered to maintain security and comply with your application's requirements.
Sources
Signing up and confirming user accounts - Amazon Cognito
Post confirmation Lambda trigger - Amazon Cognito
Pre sign-up Lambda trigger - Amazon Cognito
ConfirmSignUp - Amazon Cognito User Pools

answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.