Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

isSignUpComplete returns True in android even if the user has not been confirmed. In iOS it doesn't. #581

Closed
kkeshav93 opened this issue May 15, 2021 · 7 comments
Labels
auth Issues related to the Auth Category bug Something is not working; the issue has reproducible steps and has been reproduced fixed-in-release-candidate Issues that have been addressed in the current release-candidate branch platform-discrepancy Issues that result in inconsistent behavior between support platforms

Comments

@kkeshav93
Copy link

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:

  1. Create a Flutter Project.
  2. 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);
  3. 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.
@ragingsquirrel3 ragingsquirrel3 added auth Issues related to the Auth Category platform-discrepancy Issues that result in inconsistent behavior between support platforms labels May 17, 2021
@HuiSF
Copy link
Member

HuiSF commented May 18, 2021

I could reproduce this difference between iOS and Android, will investigate.

@HuiSF HuiSF self-assigned this May 18, 2021
@HuiSF
Copy link
Member

HuiSF commented May 18, 2021

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
}

@kkeshav93
Copy link
Author

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.

@latheeshvm
Copy link

May be have this in documentation?

@offlineprogrammer offlineprogrammer added the bug Something is not working; the issue has reproducible steps and has been reproduced label Sep 19, 2021
@HuiSF HuiSF removed their assignment Feb 21, 2022
@Jordan-Nelson
Copy link
Member

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.

@Jordan-Nelson
Copy link
Member

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!

@Jordan-Nelson Jordan-Nelson added the pending-release Issues that have been addressed in main but have not been released label Aug 2, 2022
@Jordan-Nelson Jordan-Nelson added fixed-in-release-candidate Issues that have been addressed in the current release-candidate branch and removed pending-release Issues that have been addressed in main but have not been released labels Mar 2, 2023
@Jordan-Nelson
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auth Issues related to the Auth Category bug Something is not working; the issue has reproducible steps and has been reproduced fixed-in-release-candidate Issues that have been addressed in the current release-candidate branch platform-discrepancy Issues that result in inconsistent behavior between support platforms
Projects
None yet
Development

No branches or pull requests

6 participants