amplify-flutter
amplify-flutter copied to clipboard
isSignUpComplete returns True in android even if the user has not been confirmed. In iOS it doesn't.
Describe the bug While using Amplify.Auth.signUp it requires that the user is verified with the code sent to the email before the user can be CONFIRMED in the userpool. To check if a user is confirmed one way is to check if the signup is complete. Amplify provides .isSignUpComplete. But this is behaving different in different environments. Android: Even before the user is confirmed it returns true. iOS: User needs to be confirmed or else it will return false.
This needs to be fixed or else there needs to be way for a developer to at least check if the user has been confirmed or not.
To Reproduce Steps to reproduce the behavior:
- Create a Flutter Project.
- Write code to signUp user: final createAccountResult = await Amplify.Auth.signUp( username: email.text, password: password.text, options: CognitoSignUpOptions(userAttributes: {'email': email.text})); print(createAccountResult.isSignUpComplete);
- Now run the code and signUp a user with his email and password.
Expected behavior print(createAccountResult.isSignUpComplete); should return false for both android and iOS. Because we have not yet confirmed the user.
Screenshots If applicable, add screenshots to help explain your problem.
Platform Amplify Flutter current supports iOS and Android. This issue is reproducible in (check all that apply): [X] Android [X] iOS
Output of flutter doctor -v
en-US)
• Flutter version 2.0.6 at
/Users/keshavkasichainula/Development/software/flutter
• Framework revision 1d9032c7e1 (2 weeks ago), 2021-04-29 17:37:58 -0700
• Engine revision 05e680e202
• Dart version 2.12.3
[✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
• Android SDK at /Users/keshavkasichainula/Library/Android/sdk
• Platform android-30, build-tools 30.0.3
• Java binary at: /Applications/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.5, Build version 12E262
• CocoaPods version 1.10.1
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Applications/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build
1.8.0_242-release-1644-b3-6915495)
[✓] VS Code (version 1.56.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.22.0
[✓] Connected device (2 available)
• sdk gphone x86 arm (mobile) • emulator-5554 • android-x86 • Android 11
(API 30) (emulator)
• Chrome (web) • chrome • web-javascript • Google
Chrome 90.0.4430.212
• No issues found!```
</details>
**Smartphone (please complete the following information):**
- Simulator: [Andorid: Pixel 3a, iOS: Iphone 11 ]
- OS: [iOS13, androdi 11]
- Browser [chrome]
- Version []
**Additional context**
Add any other context about the problem here.
I could reproduce this difference between iOS and Android, will investigate.
Dug into amplify-ios and amplify-android, this behavior should be intended according to the discussion here and here.
iOS
isSignupComplete is determined by AuthSignUpResult.nextStep. The former is always false when nextStep != done.
Android
isSignupComplete is marked as true once the sign up request completed successfully.
Although isSignupComplete may be inconsistent between both platforms, checking SignUpResult.nextStep should be sufficient to determine if user has completed signing up confirmation.
E.g.
SignUpResult createAccountResult = await Amplify.Auth.signUp(
username: email.text,
password: password.text,
options: CognitoSignUpOptions(userAttributes: {'email': email.text}));
if (res.nextStep.signUpStep == 'CONFIRM_SIGN_UP_STEP') {
// continue to confirm sign up step
}
if (res.nextStep.signUpStep == 'DONE') {
// complete sign up
}
Thanks that should be helpful. But I feel this issue shouldnt be closed until we unify .isSignupComplete. But thanks a lot for the alternative way of checking for if the account is confirmed or not. I will test it in my code today.
May be have this in documentation?
We are tracking this as a bug. For anyone facing this issue, the current workaround is to ignore isSignUpComplete, and use nextStep instead. This value will be consistent across platforms.
Hello - We have recently released a new developer preview version of the Auth category (amplify_flutter v1.0.0-next.0). This new version is a full re-write of the auth category in dart, and it supports Mobile, Desktop, and Web. This issue is addressed in this new version. You can read more about the developer preview release in the blog post and docs. I will update this issue again once this new version is out of developer preview.
Let me know if you have any questions!
This issue has been addressed in v1.0.0 of Amplify Flutter, which is now stable. This release also includes web and desktop support for Auth, API, Analytics, and Storage. You can see the list of new features and bug fixes in the release notes, and see more details on how to migrate in the upgrade guide.