使用确认 URL 确认 amazon cognito 后如何重定向? [英] How to redirect after confirm amazon cognito using confirmation URL?

查看:33
本文介绍了使用确认 URL 确认 amazon cognito 后如何重定向?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在用户在 amazon cognito 中确认后重定向到特定的 url.

I want to redirect to a specific url after the user confirmation in amazon cognito.

当用户注册时,他将收到带有验证链接的确认邮件,如下所示https://<>.auth.us-west-2.amazoncognito.com/confirmUser?client_id=<<>>&user_name=<<>>&confirmation_code=<<>>

When a user sign up he will get confirmation mail with a verification link as follows https://<>.auth.us-west-2.amazoncognito.com/confirmUser?client_id=<<>>&user_name=<<>>&confirmation_code=<<>>

如果用户点击上面的链接,它将重定向到确认页面.

If the user clicks the above link it will redirect to confirmation page.

完成用户确认后,页面应重定向到我的应用程序.

Once the user confirmation is completed the page should redirect to my application.

请给我一些解决这个问题的想法.

Please give me some idea to solve this problem.

推荐答案

目前,无法使用电子邮件中的验证链接完成此重定向.不久前,我尝试将 redirect_uri 添加到验证 URL,但它们不起作用.

Currently, this redirection can't be done using verification link in email. I tried adding redirect_uri to the verification URL a while back but they do not work.

解决方法

成功后,从您的 API 网关返回 302 https://myapp.com

On success, return 302 https://myapp.com from your API Gateway

我知道对于这样一个简单的要求,这是一个复杂的解决方法.最好的方法是提出功能请求,并希望他们支持 Cognito URL 中的 redirect_uri.

I know this is a convoluted workaround for such a simple requirement. The best way would be to raise a feature request and hope they support a redirect_uri in the Cognito URL.

编辑

为了节省 lambda 成本,您还可以在 API 中使用 HTTP 端点并向 cognito 服务端点.示例:

To save your lambda costs, you could also use an HTTP endpoint in your API and make a request to the cognito service endpoint for your region. Example:

POST  HTTP/1.1
Host: cognito-idp.us-east-1.amazonaws.com
x-amz-target: AWSCognitoIdentityProviderService.ConfirmSignUp
Content-Type: application/x-amz-json-1.1

{
  "ClientId":"xxxxxxxxxxxxx",
  "ConfirmationCode":"123456",
  "Username":"username"
}

这篇关于使用确认 URL 确认 amazon cognito 后如何重定向?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆