Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redirect to url after clicking email verification link  #9006

Open
saad8it opened this issue Oct 10, 2021 · 9 comments
Open

Redirect to url after clicking email verification link  #9006

saad8it opened this issue Oct 10, 2021 · 9 comments
Labels
Auth Related to Auth components/category feature-request Request a new feature Service Team Issues asked to the Service Team

Comments

@saad8it
Copy link

saad8it commented Oct 10, 2021

Is this related to another service?

Cognito

Describe the feature you'd like to request

Opening the issue again previously posted by another user

When the user clicks on the email verification link, they're taken to a confirmation page, located at
https://APP.auth.us-east-2.amazoncognito.com/confirmUser?client_id=CLIENT_ID&user_name=USERNAME&confirmation_code=CODE

I'd like the ability to specify a URL that the confirmation page will redirect to, thereby auto logging in the user. This will make the signup flow more streamlined. Perhaps there could be an extra parameter for the redirect url.
https://APP.auth.us-east-2.amazoncognito.com/confirmUser?client_id=CLIENT_ID&user_name=USERNAME&confirmation_code=CODE&redirect=URL

The way it works now is that after clicking the link, the user has to go back to my app and log in again, which is awkward.

Describe the solution you'd like

The way it works now is that after clicking the link, the user has to go back to my app and log in again, which is awkward.

Describe alternatives you've considered

I have tried using lambda triggers but having difficulties setting it up

@saad8it saad8it added the feature-request Request a new feature label Oct 10, 2021
@sammartinez sammartinez added Service Team Issues asked to the Service Team Auth Related to Auth components/category labels Oct 20, 2021
@alexandervonwl
Copy link

alexandervonwl commented Dec 18, 2022

Hi, is this implemented, I want to redirect, not using amplify, just cognito? Thank you :)

@ledgerdevelop
Copy link

This is really basic auth feature needed as the UX ist really bad otherwise. The workaround is terrible right now and autoSignIn is still a struggle. Come on: if you want to make amplify better and usable work on this ASAP please.
It is in high demand by the amplify dev community.

@oantacamelia
Copy link

oantacamelia commented Mar 27, 2023

We are building a flutter app and wanted to redirect the user to the app after he clicks the confirmation link received in the email. Please consider adding this feature, indeed the UX is really bad. Still waiting for a solution, if anyone had any luck to find a workaround for this.

@wangruoni
Copy link

+1, otherwise UI looks really bad

@gmicek
Copy link

gmicek commented Aug 17, 2023

+1 we want this thanks!

@BernhardSmuts
Copy link

Any movement on this feature?

@clairolzam
Copy link

+1

@mahmoud-anwer
Copy link

Any updates?

@saad8it
Copy link
Author

saad8it commented May 9, 2024

Sorry for the late Update i did find a solution back when i was implementing (2021) and i documented the process so sharing the logic hopefully it works till now too

For verify Aws user verification customization follow the following steps

1-Create a lambda function from the following link

https://eu-central-1.console.aws.amazon.com/lambda/home?region=eu-central-1#/functions

2-After creating lambda function paste the following code into the lamda function

`
exports.handler = (event, context, callback) => {

if(event.triggerSource === "CustomMessage_SignUp") {

    console.log('function triggered');
    
    console.log(event);
    
    // Ensure that your message contains event.request.codeParameter. This is the placeholder for code that will be sent
    const { codeParameter } = event.request
    
    const { userName, region } = event
    
    const { clientId } = event.callerContext
    
    const { email } = event.request.userAttributes
    
    const url = 'use the url of your app'
    
    const link = `<a href="${url}?code=${codeParameter}&username=${userName}&clientId=${clientId}&region=${region}&email=${email}" target="_blank">Verify
    </a>
    `
    
    event.response.emailSubject = "Your verification link"; // event.request.codeParameter
    
    event.response.emailMessage = `<!DOCTYPE html>
`

3- Go to User Pool

4-Click on the trigger option
image

5-Select the already created lambda function in post confirmation
image

6-Save changes

7-click on the message customization in user pool cognito

7- Now here we have to change link to code

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Auth Related to Auth components/category feature-request Request a new feature Service Team Issues asked to the Service Team
Projects
None yet
Development

No branches or pull requests

10 participants