cognito-local icon indicating copy to clipboard operation
cognito-local copied to clipboard

InitiateAuth should not allow users that are unconfirmed

Open chunleng opened this issue 3 years ago • 3 comments

Kudos to all the hardwork on this project! It really make my local environment so much easier to work with!

As stated in title, I tested the behavior on Cognito and with this repository. It seems like on Cognito, after registering the user has the status of "unconfirmed" and when you try to login, you get "UserNotConfirmedException".

However, it did not happen in cognito-local, even though you have written InitiateAuth as partially implemented, I thought it might be nice to notice you about the difference

chunleng avatar Feb 02 '22 10:02 chunleng

Popped in to request this feature as well! And then found that @chunleng has already logged it. Thanks!

It looks to me like the solution would be to check the UserStatus for confirmation somewhere in this general area: https://github.com/jagregory/cognito-local/blob/fc62e8f6328863e8fde549aec73f40c8c27c457b/src/targets/initiateAuth.ts#L169

By the looks of it, a 400 UserNotConfirmedException would be the expected server-side response. https://docs.aws.amazon.com/cognito-user-identity-pools/latest/APIReference/API_InitiateAuth.html

LMK if this is a feature you are thinking of adding @jagregory

Appreciate what you have done here so much!

RobHoman avatar Feb 21 '22 18:02 RobHoman

Hey @RobHoman, definitely just an oversight on my part. PRs definitely welcome if you're up to it, otherwise I'll give it a go when I can.

jagregory avatar May 30 '22 07:05 jagregory

@jagregory Totally makes sense! I haven't yet taken the time to become fully acquainted with your development setup, and furthermore I'm a bit n00b at node.js (mostly focused on golang over here)

All that to say - while I think at some point I'll explore and begin to contribute a bit here, for the near feature you can at least anticipate that I'll continue to do my best to log quality feature requests & issues as they come up in my work.

RobHoman avatar Jun 02 '22 16:06 RobHoman

PR #337 should fix this, I believe.

paullallier avatar Nov 24 '22 00:11 paullallier

@jagregory Is there anything holding you back from merging @paullallier's contribution of PR #337 to fix this issue?

RobHoman avatar May 27 '23 23:05 RobHoman

This has been released in 3.23.2. Thanks for the nudge @RobHoman.

jagregory avatar May 28 '23 06:05 jagregory

That's awesome, thanks!

RobHoman avatar May 29 '23 20:05 RobHoman