Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Cognito Verification Type to Link in CloudFormation

I'm trying to figure out how I can set the verification type from Code (default) to Link in my CloudFormation template.

In the website I can set it here: example

If I take a look at the docs there is nothing mentioned. My CloudFormation looks like

SomeUserPoolResourceName:
  Type: AWS::Cognito::UserPool
  Properties:
    UserPoolName: SomeResource_User_Pool
    EmailVerificationType: Link  # I want something like this
    EmailVerificationSubject: 'Your verification link'
    EmailVerificationMessage: 'Please click the link below to verify your email address. {##Verify Email##}' # fails because {####} is required
    AliasAttributes:
      - email
    AutoVerifiedAttributes:
      - email
    Policies:
      PasswordPolicy:
        - .... 
    Schema:
      - ....

Is it possible to configure this via CloudFormation?

like image 710
Philipp Avatar asked Jan 31 '18 08:01

Philipp


People also ask

How do I verify my Amazon email with Cognito?

Amazon Cognito can automatically verify email addresses or phone numbers. To do this verification, Amazon Cognito sends a verification code or a verification link. For email addresses, Amazon Cognito can send a code or a link in an email message. For phone numbers, Amazon Cognito sends a code in an SMS text message.

How do I verify a Cognito user?

Call the SignUp API action, and provide the email address and phone number for the UserAttributes parameter. At this point, Amazon Cognito sends a verification code to the user's phone. In your app interface, present a confirmation page where the user enters the verification code.

What is callback URL in Cognito?

A callback URL indicates where the user will be redirected after a successful sign-in. Enter Sign out URL(s). A sign-out URL indicates where your user will be redirected after signing out. Select Authorization code grant to return an authorization code that is then exchanged for user pool tokens.

What is the difference between user pool and identity pool?

With a user pool, your app users can sign in through the user pool or federate through a third-party identity provider (IdP). Identity pools are for authorization (access control). You can use identity pools to create unique identities for users and give them access to other AWS services.


2 Answers

No, it is not possible currently. As per the updated CreateUserPool API, a new VerificationMessageTemplate parameter will allow us to do this but cloudformation has yet to support this. AWS Support told that there is an existing feature request for the same. You can look into custom cloudformation resources as a workaround.

like image 96
agent420 Avatar answered Sep 28 '22 08:09

agent420


Try this:

SomeUserPoolResourceName:
  Type: AWS::Cognito::UserPool
  Properties:
    UserPoolName: SomeResource_User_Pool
    VerificationMessageTemplate:
       DefaultEmailOption: CONFIRM_WITH_LINK
    EmailVerificationSubject: 'Your verification link'
    EmailVerificationMessage: 'Please click the link below to verify your email address. {##Verify Email##}' # fails because {####} is required
    AliasAttributes:
      - email
    AutoVerifiedAttributes:
      - email
    Policies:
      PasswordPolicy:
        - .... 
    Schema:

Change this part:

EmailVerificationType: Link  # I want something like this

For:

VerificationMessageTemplate:
  DefaultEmailOption: CONFIRM_WITH_LINK
like image 38
Daniel Golgher Avatar answered Sep 28 '22 07:09

Daniel Golgher