amazon-web-servicesaws-lambdaaws-sdkamazon-cognitoamazon-sns

Get Cognito verification code in lambda to send SMS using local provider


I want to send verification code to the users mobile as SMS using a local provider in my country without using AWS SNS.

I have a trigger in CustomMessage and lambda function is working fine. But my problem I am unable to find verification code in lambda function.Only find codeParameter which is {####}.

So how can I get the verification code to send it using local provider?


Solution

  • You need to implement Custom Authentication in this scenario. Because Cognito wouldn't share the secret with you. We have implemented Custom Authentication scenario using Cognito Custom authentication mechanism.

    you could use DefineAuth,CreateAuth and VerifyAuth triggers for implementation. please refer to the following flow.

    https://aws.amazon.com/blogs/mobile/customizing-your-user-pool-authentication-flow/