简体   繁体   English

AWS Cognito:使用 postman 测试触发器

[英]AWS Cognito: Test triggers using postman

I am very new to AWS and I am trying to implement passwordless authentication.我是 AWS 的新手,我正在尝试实施无密码身份验证。 I have created an user pool and has implemented triggers for phone & OTP authentication in AWS Cognito by following this tutorial: https://youtu.be/m8DE5ZV4FG4我创建了一个用户池,并按照本教程在 AWS Cognito 中实现了电话和 OTP 身份验证触发器: https://youtu.be/m8DE5ZV4FG4

I created an user using the Hosted UI in the App Client Settings in AWS Cognito.我在 AWS Cognito 的应用程序客户端设置中使用托管 UI 创建了一个用户。 But unfortunately I didn't receive any OTP in the number which was used to sign up.但不幸的是,我没有收到用于注册的号码中的任何 OTP。 Is this the right way to test it?这是测试它的正确方法吗? Is there a way to test the triggers without using AWS Amplify, for eg: by using another software like Postman?有没有办法在不使用 AWS Amplify 的情况下测试触发器,例如:通过使用其他软件,如 Postman?

Just calling those lambdas will not trigger user creation, or confirmation.仅调用这些 lambda 不会触发用户创建或确认。 User creation happens if a user calls the Cognito signup apis and:如果用户调用 Cognito 注册 API 并且:

  1. the username isn't taken用户名未被占用
  2. the pre-signup trigger succeeds ( or you don't have one ) they define "succeeds" by saying the event they passed into the lambda was returned to them with only the "response" object modified.预注册触发器成功(或者你没有)他们通过说他们传递给 lambda 的事件被返回给他们来定义“成功”,只有“响应”object 被修改。

All you could do with postman was expose your lambda trigger(s) through something like API Gateway, and pass in various payloads to see if it responds correctly.你对 postman 所能做的就是通过类似 API 网关的东西公开你的 lambda 触发器,并传入各种有效负载以查看它是否正确响应。 that is one way to do it..这是一种方法..

Personally what i do to validate triggers is write unit tests that run when the trigger deploys that tests out various payloads to the triggers against an expected response.就我个人而言,我为验证触发器所做的工作是编写在触发器部署时运行的单元测试,根据预期响应测试触发器的各种有效负载。

I'm not sure what language you're writing the lambda in, but any would have SDK's available to call Cognito directly to sign up a user.我不确定你用什么语言编写 lambda,但任何语言都可以使用 SDK 直接调用 Cognito 来注册用户。 That would in turn call your trigger.那会反过来调用你的触发器。 await Cognito.signUp({... }) for me in node.在节点中为我await Cognito.signUp({... })

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Api Gateway Cognito 授权方:客户端令牌适用于 AWS ui 但不适用于 Postman - Api Gateway Cognito Authorizer: client token works on AWS ui but not on Postman 将 api 网关与 aws cognito 一起用于受保护的路由 - using api gateway with aws cognito for protected routes 在 DynamoDB 中使用 AWS Cognito UserID 作为分区键 - Using AWS Cognito UserID as partition key in DynamoDB 使用普通 JavaScript 中的 AWS cognito - Using AWS cognito from plain JavaScript 使用 Cognito 在 AWS RDS 中存储用户详细信息 - storing user details in AWS RDS using Cognito Aws sam cognito api 网关 - 禁止访问令牌,但如果它来自 postman,则可以使用 - Aws sam cognito api gateway - access token forbidden but works if it's from postman 从 Postman 或 cURL 访问时从 AWS Cognito + API 网关获取 401 Unauthorized - Getting 401 Unauthorized from AWS Cognito + API Gateway when accessing from Postman or cURL Postman:使用 Postman 读取放置在 aws 中的 csv 文件? - Postman: Read a csv file placed in aws using Postman? AWS Cognito 与 AWS SSO - AWS Cognito with AWS SSO Cognito + Google + React - 注销无法使用 aws amplify - Cognito + Google + React - signout not working using aws amplify
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM