如何根据aws cognito中的特殊条件对用户进行身份验证

How to authenticate user based on special condition in aws cognito

This is a follow up question of this question

基本上我想在某些条件通过时对用户进行身份验证。 这基本上就像一个无密码流程。

在这个流程中,我有一个交换服务器颁发的 jwt 令牌。

如果 jwt 令牌有效,则 aws cognito 应将此请求视为已通过身份验证并提供访问令牌以供使用。

不需要刷新令牌,因为交换服务器颁发的 jwt 令牌将充当刷新令牌。

我找到了解决方案。

https://aws.amazon.com/blogs/mobile/implementing-passwordless-email-authentication-with-amazon-cognito/

基本上,Verify Auth Challenge 触发器中的逻辑已更改。 这里我们需要验证交换服务器提供的令牌。 Aws cognito 提供了一个很好的 api 来正确配置它。