Closed timheilman closed 3 months ago
I've now managed to test this using a genuine SMS Pinpoint Origination identity and no custom sms sender cognito trigger lambda. SignUp and SignIn SMS messages are sent, but reset password messages are not. The response from amplify/auth's resetPassword call is successful, the same as above.
Oops. https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_cognito.AccountRecovery.html
I had been on the default, PHONE_WITHOUT_MFA_AND_EMAIL .
To get the behavior I was hoping for, need: PHONE_AND_EMAIL
It's discouraged, but that was the setting I was looking for. Never mind.
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
Authentication
Amplify Version
v6
Amplify Categories
auth
Backend
CDK
Environment information
Describe the bug
I have a customSmsSender trigger configured like so (CDK):
In the lambda construct:
In the cognito construct (including it all, although it is the lambdaTriggers section that is relevant:
When using the functions from
aws-amplify/auth
v6:confirmSignUp
correctly invokes the customSmsSender lambdaconfirmSignIn
correctly invokes the customSmsSender lambdaresendSignUpCode
correctly invokes the customSmsSender lambdaresetPassword
does not invoke the customSmsSender lambdaThis is despite that a successful response is returned from
resetPassword
:That successful response indicates that an SMS was "sent" with the code to reset the user's password. These are the custom SMS trigger events:
https://docs.aws.amazon.com/cognito/latest/developerguide/user-pool-lambda-custom-message.html#cognito-user-pools-lambda-trigger-syntax-custom-message-trigger-source
CustomMessage_SignUp
is workingCustomMessage_Authentication
is workingCustomMessage_ResendCode
is workingCustomMessage_ForgotPassword
by contrast never causes invocation of the custom sms trigger lambdaExpected behavior
Given that the successful response from
aws-amplify/auth
'sresetPassword
hasresetPasswordStep
set toCONFIRM_RESET_PASSWORD_WITH_CODE
, the custom SMS Sender trigger lambda should get invoked withevent.triggerSource === "CustomSMSSender_ForgotPassword"
.Reproduction steps
Set up a cognito user pool, with the settings as shown in the CDK code above. Create and verify a user using a phone number as username alias and using SMS verification. (You can retrieve the SMS verification code via the custom trigger lambda.) Log out as that user. Use
aws-amplify/auth
's call,resetPassword
, sending the same phone number. Receive the success payload:Note that the custom SMS send trigger lambda is never invoked.
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
Additional configuration
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response