How can I use "click the confirmation link" authentication instead of confirmation code authentication with AWS Cognito?
The confirm user email currently looks like this:
How can I use "click the confirmation link" authentication instead of confirmation code authentication with AWS Cognito?
The confirm user email currently looks like this:
You can set that in Cognito user pool settings under General Settings > Message Customizations > Do you want to customize your email verification messages? > Verification type
. Choose Link
.
Or if you use CDK, you can set it in code.
const userPool = new UserPool(this, "userPool", {
userVerification: {
emailStyle: VerificationEmailStyle.LINK,
}
...
If you want to do it the Amplify way you can create an auth override (amplify override auth
) and make the following override.ts file:
import { AmplifyAuthCognitoStackTemplate } from '@aws-amplify/cli-extensibility-helper';
export function override(resources: AmplifyAuthCognitoStackTemplate) {
resources.userPool.addPropertyOverride('VerificationMessageTemplate', {
...(resources.userPool.verificationMessageTemplate as any),
// Let users confirm their email with a link instead of a code
DefaultEmailOption: 'CONFIRM_WITH_LINK',
// Optional contents of message, only supported if using SES for sending emails
EmailMessage: `Please verify your email address by visiting {##this link##}.`,
});
}
© 2022 - 2024 — McMap. All rights reserved.