Closed piyushk-sony closed 1 year ago
More Information: I'm seeing is that GetUserAttributeVerificationCode is failing for the user because the user doesn't have an attribute for the verification code?
My SignUp request looked as follows: X-Amz-Target: AWSCognitoIdentityProviderService.SignUp Payload:
{"ClientId":"4z77kse4e7731bigsn07mgb3o","Username":"tester@test.com","Password":"test1234","UserAttributes":[{"Name":"email","Value":"tester@test.com"}],"ValidationData":null}
Response:
{"UserConfirmed":false,"UserSub":"9be9b1c3-7f9e-4e4c-9e06-597af551d13d"}
Here's the user as created by cognito-local:
{
"Username": "tester@test.com",
"Attributes": [
{
"Name": "sub",
"Value": "9be9b1c3-7f9e-4e4c-9e06-597af551d13d"
},
{
"Name": "email",
"Value": "tester@test.com"
}
],
"UserCreateDate": 1682524586,
"UserLastModifiedDate": 1682524586,
"Enabled": true,
"UserStatus": "UNCONFIRMED"
}
Hey @piyushk-sony, sorry to hear you're having issues. The console logging does work (I use it myself), but there might be some combination of user pool setting you're missing or unexpected behaviour of cognito-local vs real cognito.
When a user signs up, a combination of the pool's AutoVerifiedAttributes
and the user's Attributes
are used to determine if a code should be sent to them. If it is sent it will be printed to the console.
For example, your user pool should have an AutoVerifiedAttributes
set to email
and your user should have an email
attribute. If both of those aren't true a code won't be sent/printed. I can see your user has the email
attribute, does your user pool have AutoVerifiedAttributes
set?
This is the logic:
As for GetUserAttributeVerificationCode
not working, that definitely sounds like a legit issue. Possibly the code isn't being saved against the user because of the above logic, when it should be saved even if the message isn't sent.
Thanks a lot @jagregory. That was exactly it. Creating the user-pool
with --auto-verified-attributes email
shows the confirmation code output.
I'm using cognito-local with a simple full stack example to allow our users to add auth during local testing of the stack without having to provision a Cognito User Pool in AWS. I'm using it via docker (
jagregory/cognito-local:latest
) and docker-compose and the default configuration.The README suggests that confirmation codes should be printed in the logs https://github.com/jagregory/cognito-local#confirmation-codes,. Is there a configuration option I need to enable to print those confirmations to the screen? I have confirmed that the SignUp request is being received and processed by Cognito-local and the user is added with "UserStatus" as "UNCOMFIRMED", but no sign up code is printed on the screen.
Notes: