So, I am using (or at least trying to) Amazon Cognito with Lambda functions for auth. Here's the flow: I send request, it goes to API Gateway, which directs it to a specific Lambda function. I am using Node JS with amazon-cognito-identity-js library. I am able to register user. The thing is that, Cognito sends email with the confirmation code after the registration. I am unable to create another Lambda (API endpoint) function for confirmation, since it requires CognitoUser object (which you receive after registering or login). Here is the code from AWS documentation:
cognitoUser.changePassword('oldPassword', 'newPassword', function(err, result) {
if (err) {
alert(err);
return;
}
console.log('call result: ' + result);
});
So basically, it's not designed for Lambda functions, since it requires to save the state - the user after the registration. Am I getting it wrong? Is there a way?