Closed KristianLake closed 10 months ago
Hi @KristianLake,
Upon reviewing this, I have a few question for you - can you please confirm the following:
Can you confirm the SignUp experience you have configured? i.e. Do users sign up with a username or email? You can confirm this by going into your UserPool in the Cognito console, and under Sign-in experience look at Cognito user pool sign-in options
In the reproduction steps above, I see the username passed to Auth.resendSignUp()
is not an email - is this a typo? If not, note that this would need to be an email if your signup experience is set to email.
Also you can you share the users info that you are attempting to resend the code to as seen in Cognito?
The resendSignUp()
takes a username as a parameter. So if you have your signup experience set to User name
, that will be the username they entered on signUp
, however if it is setup to be email
, it will be the email a user entered.
Also, note that the username
can be different from the email configured under the users attributes
.
Sure, so im using sst and my configuration is completely done IAAC.
const auth = new Auth(stack, "Auth", {
triggers: {
customMessage: {
handler: "services/cognito/customMessage.main",
environment: { TABLE_NAME: table.tableName },
permissions: [table],
},
preSignUp: {
handler: "services/cognito/preSignUp.main",
},
postConfirmation: {
handler: "services/cognito/postConfirmation.main",
environment: { TABLE_NAME: table.tableName },
permissions: [table],
},
},
cdk: {
userPool: {
email: cognito.UserPoolEmail.withSES({
sesRegion: 'us-east-2',
fromEmail: 'noreply@example.com',
fromName: `${stack.stage.toLowerCase() === "prod" ? "" : stack.stage.toLowerCase()} Support`,
replyTo: 'support@example.com',
sesVerifiedDomain: 'example.com',
}),
deviceTracking: {
challengeRequiredOnNewDevice: true,
deviceOnlyRememberedOnUserPrompt: true,
},
// Users can login with their email and password
signInAliases: {
username: true,
email: true,
},
},
},
})
auth.attachPermissionsForTrigger("preSignUp", ["cognito-idp:ListUsers"]);
auth.attachPermissionsForTrigger("postConfirmation", ["ses:SendEmail"]);
So as you can see users can login with their email AND username.
So if a user elects to login with their username but they have not yet confirmed via email (during register they provided username and email) there is no easy way to wire up the Auth.resendSignUp( as during login they provided the username only and you can't get the email (as they did not submit it) So short of taking the username and running though a custom gateway api call to "get me the email for this username" to then pass into resendSignUp - which adds a delay, a possible security vector and additional network calls though AWS.
@nadetastic @nickarocho Guys, do you have any updates?
Hi @KristianLake following up here - based on the error message UserNotFoundException: Username/client id
there's either a mismatch with the userpool client that the client app is using verses where the user is actually sign up in. On way to check this is to verify the values being passed into Amplify.configure()
. If the userpool, or userpoolClient do not match this will cause this issue.
Are you still experiencing this problem?
cc @Alexei-Lashakov
Closing this issue as we have not heard back from you. If you are still experiencing this, please feel free to reply back and provide any information previously requested and we'd be happy to re-open the issue.
Thank you!
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
Authentication
Amplify Categories
auth
Environment information
Describe the bug
This is while the user status is unconfirmed.
returns UserNotFoundException: Username/client id combination not found.
Expected behavior
It should know that email can be used to resend code.
Reproduction steps