Skip to content

Sign In with Auth.confirmSignUp #6320

@mousedownmike

Description

@mousedownmike

Is your feature request related to a problem? Please describe.
This feature is related to closed issue #2562, that request was to support signing in a user with the Auth class when a successful Auth.confirmSignUp request was made. The ticket was closed based on a UI implementation that does not solve the issue for users of the Auth class directly.

Describe the solution you'd like
The Auth library should have the option to automatically sign-in a user when they successfully complete the Auth.confirmSignUp request. This should be made possible without requiring the calling application to persist the user's credentials (username and password) between requests.

The following would be my ideal use case:

  1. A new site user is successfully registered with Auth.signUp. The site/app does NOT persist the user's password so it is no longer known by the local client.
  2. The site presents the code delivery details (e.g. SMS, Email...) to the new user so they know where to find their confirmation code.
  3. The site presents a form with a field for the username/email (pre-populated if the user has not left the flow) and an empty field for the confirmation code.
  4. The user retrieves the confirmation code from the indicated delivery method.
  5. The user enters the valid confirmation code (and username if not pre-populated) and submits the form.
  6. The site successfully performs Auth.confirmSignUp with the supplied username and code.
  7. The Auth library validates the username and code and upon receiving a valid response is able to generate a fully realized/signed-in CognitoUser locally. No further calls to Auth.signIn are required.

This flow is essentially using the confirmation code as a one-time password which seems reasonable.

Describe alternatives you've considered
Multiple alternatives are discussed in #2562 and the React UI implementation is one alternative although it appears to require persisting the user's password locally between requests which seems like a potential security risk.

Additional context
My assumption based on reading #2562 was that this would require some changes to the Cognito service. I imagine that is the case so that confirmSignUp returns a valid token but I can't find any tickets that represent that change request nor do I even know where to look for such a request.

Metadata

Metadata

Assignees

Labels

AuthRelated to Auth components/categoryService TeamIssues asked to the Service Team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions