amazon-web-servicesamazon-cognitoaws-amplifyaws-amplify-sdk-js

Customize email verification page AWS Cognito


I am using Amazon Cognito for user authentication. After the user is registered verification email is sent to his email address. After clicking on the email link he is prompted with this in his browser.

Aws verification page

How can I customize this page in order to insert a script that will trigger deep links within the mobile application, and also make the page look bit nicer?


Solution

  • You can do that using Cognito triggers.

    You can configure a trigger template to define a message with a link to a page you control. The assets will be stored at: amplify/backend/auth/<your-resource-name>CustomMessage/assets

    The documentation has more details

    Cognito allows you to configure your User Pool to send an email to your users when they attempt to register an account. You can configure this email to contain a link to Cognito’s Hosted UI where the user’s account will be marked as confirmed.

    This trigger template allows you to define an email message with a link to a static S3 bucket that you control, where the user’s account will be confirmed and they can then be redirected to a URL of your choice (presumably your application). The URL will automatically contain the username as a query string parameters.

    Please note that this trigger template will create an S3 resource. The files that populate the static site are available for edit in amplify/backend/auth/CustomMessage/assets. They consist of:

    index.html
    spinner.js (controls the spinner that appears on the page while users are awaiting confirmation)
    style.css
    verify.js (the script which performs the verification request)