Describe the bug
Code sample below is broken on the link here
Current Code
Future<SignInResult> signInWithCognito(
String username,
String password,
) async {
final SignInResult result = await Amplify.Auth.signIn(
username: username,
password: password,
);
return _handleSignInResult(result);
}
Future<void> _handleSignInResult(SignInResult result) async {
switch (result.nextStep.signInStep) {
case AuthSignInStep.continueSignInWithMfaSelection:
// Handle select from MFA methods case
case AuthSignInStep.continueSignInWithTotpSetup:
// Handle TOTP setup case
case AuthSignInStep.confirmSignInWithTotpMfaCode:
// Handle TOTP MFA case
case AuthSignInStep.confirmSignInWithSmsMfaCode:
// Handle SMS MFA case
case AuthSignInStep.confirmSignInWithNewPassword:
// Handle new password case
case AuthSignInStep.confirmSignInWithCustomChallenge:
// Handle custom challenge case
case AuthSignInStep.resetPassword:
// Handle reset password case
case AuthSignInStep.confirmSignUp:
// Handle confirm sign up case
case AuthSignInStep.done:
safePrint('Sign in is complete');
}
}
Possible fixes
Updating return types on the signInWithCognito function to Future<void> or return a success or fail boolean.
Describe the bug Code sample below is broken on the link here
Current Code
Possible fixes Updating return types on the
signInWithCognito
function toFuture<void>
or return a success or fail boolean.