Skip to content

To resend verification code, email is not received when sendUserAttributeVerificationCode is called #14659

@hurmain8

Description

@hurmain8

Before opening, please confirm:

JavaScript Framework

React Native

Amplify APIs

Authentication

Amplify Version

v6

Amplify Categories

auth

Backend

None

Environment information

Details
# Put output below this line


Describe the bug

  1. email received first time when updateUserAttributes is used.
  2. to resend the code, I use sendUserAttributeVerificationCode but can't receive any code

Expected behavior

  • sendUserAttributeVerificationCode should be working and email should be received

Reproduction steps

  1. use signup method to register as anonymous user i.e username=uuid.v4() and password=uuid.v4()
  2. use updateUserAttributes method
  3. use updatePassword to update new password entered by user
  4. At this time, email is received which is fine.
  5. To resend verification code, call sendUserAttributeVerificationCode but can't receive any email

Code Snippet

import {  signUp, signIn, updatePassword, updateUserAttributes, sendUserAttributeVerificationCode } from "aws-amplify/auth"


1. register as anonymous user:

generateAnonymousUserCredentials() {
      const username = uuidToString(uuid.v4())
      const password = uuidToString(uuid.v4()).slice(0, 10)
     const signUpResult: SignUpOutput = yield signUp({
            username,
            password,
          })

      yield signIn({ username, password })
    
}

2. after using updateAttributes, I get email which is fine.
const updateAttributes = async (values) =>{ 
  const userAttributes = {
                  family_name: values.lastName,
                  given_name: values.firstName,
                  email: values.email,
             
                }
await updateUserAttributes({ userAttributes })
 await updatePassword({
                  oldPassword: values.oldPassword,
                  newPassword: values.password,
                })
}

3. After 1 minute, I try to use resendCode to get verification code but I can't receive it.

const resendCode = async () => {
await sendUserAttributeVerificationCode({
          userAttributeKey:"email",
        })

}

Log output

Details
// Put your logs below this line

1. after using after using updateAttributes, got following response and also got email:

{
  "CodeDeliveryDetailsList": [
    {
      "AttributeName": "email",
      "DeliveryMedium": "EMAIL",
      "Destination": "h***@g***"
    }
  ]
}

2. after using sendUserAttributeVerificationCode, got following response but no email:

{
  "CodeDeliveryDetails": {
    "AttributeName": "email",
    "DeliveryMedium": "EMAIL",
    "Destination": "h***@g***"
  }
}

aws-exports.js

No response

Manual configuration

No response

Additional configuration

No response

Mobile Device

No response

Mobile Operating System

No response

Mobile Browser

No response

Mobile Browser Version

No response

Additional information and screenshots

I have also looked into https://github.com/aws-amplify/amplify-js/issues/13432 that is already reported but I still can't find any solution.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions