furaiev / amazon-cognito-identity-dart-2

Unofficial Amazon Cognito Identity Provider Dart SDK, to easily add user sign-up and sign-in to your mobile and web apps with AWS.
MIT License
182 stars 113 forks source link

Allow CUSTOM_AUTH authentication flow via SRP password verification #215

Closed konectech closed 1 year ago

konectech commented 1 year ago

The custom authentication flow can be used with standard SRP password verification. The initial challenge is done using SRP and the custom authentication can provide an MFA challenge such as email.

More information on this can be found here. https://aws.amazon.com/blogs/mobile/extending-amazon-cognito-with-email-otp-for-2fa-using-amazon-ses/

The initial code migration captured this flow with all the appropriate methods in place. This PR just allows the CUSTOM_AUTH authentication flow to be run via the authenticateUser method.

authDetails = AuthenticationDetails(
  username: username,
  password: password,
);
cognitoUser.setAuthenticationFlowType('CUSTOM_AUTH');
cognitoUser.authenticateUser(authDetails)
furaiev commented 1 year ago

@konectech thank you for your PR. Could you please add a note to the readme regarding CUSTOM_AUTH? Thanks!

furaiev commented 1 year ago

Thank you @konectech, your contribution is available as of version 3.2.0.