Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cognito Custom Message with HTML Tag

I am sending Cognito Verification Link with a message that have HTML Tags.

I am trying to send the codeParameter inside a custom button:

 <div align="center" class="button-container center" style="padding-right:5px;padding-left:5px;padding-top:15px;padding-bottom:15px">
  <a href="{####}" target="_blank" style="display:block;text-decoration:none;-webkit-text-size-adjust:none;text-align:center;color:#323232;background-color:#ffc400;border-radius:25px;-webkit-border-radius:25px;-moz-border-radius:25px;max-width:210px;width:160px;width:auto;border-top:0 solid transparent;border-right:0 solid transparent;border-bottom:0 solid transparent;border-left:0 solid transparent;padding-top:5px;padding-right:25px;padding-bottom:5px;padding-left:25px;font-family:'Droid Serif',Georgia,Times,'Times New Roman',serif;mso-border-alt:none">
    <span style="font-size:16px;line-height:32px">Verify your email</span>
  </a>
</div>

But It sends this to me:

x-webdoc://9166B278-3889-4E59-A9E2-F88FD6970944/%7B##</a>

Instead of a link like this:

https://xxxxx.auth.us-east-2.amazoncognito.com/confirmUser?client_id=xxxxxxxxxxxxxxx&user_name=marcuspdg22&confirmation_code=244905
like image 642
Marckaraujo Avatar asked Dec 04 '22 19:12

Marckaraujo


1 Answers

I had the same problem. Here are some tips that worked for me:

  • Don't use full HTML page, just put the HTML code included in your <body></body>
  • Javascript, Jquery, etc is not supported
  • Inside your UserPool console, go to Message Customizations and change your verification type to Code. After that, just create a confirmation link with this code in your lambda trigger like 'https://{yourUserPoolDomain/confirmUser?client_id={yourClientId}&user_name=' + event.userName + '&confirmation_code=' + event.request.codeParameter

You can put this confirmation link inside a href tag. Let me know if it worked for you.

like image 105
Olavo Holanda Avatar answered Dec 11 '22 17:12

Olavo Holanda