Git Product home page Git Product logo

Comments (5)

Jordan-Nelson avatar Jordan-Nelson commented on June 5, 2024 1

@AmeenIzhac - Let me know if the suggestion about storing the username on the device works for your use case. If not, please see the questions I had asked above. Thanks.

from amplify-flutter.

Jordan-Nelson avatar Jordan-Nelson commented on June 5, 2024 1

If they try to sign up, it will throw an exception that the user already exists.

If they tried to sign up again - yes. Some users would attempt to sign in, not sign up. For those users this step would be skipped.

The flow you have described is more or less what the experience would be with the prebuilt Authenticator widget. The Authenticator widget (by default) opens to the Sign In page, so I think many users would attempt to sign in, and then be redirected to confirm their account. I believe after the user confirms their account there is an attempt to sign them in automatically using the username/password they entered originally so they aren't asked to enter the info again. The flow is:

  • open app
  • enter username/password
  • enter confirmation code
  • user is confirmed and signed in

If we were to store the username on the device for users that needed confirmation, they would still need to enter their password in after they confirm their account (Amplify will never store a password on the device). So the flow would be

  • open app
  • enter confirmation code
  • enter password
  • user is confirmed and signed in

It is the same number of steps and only requires one less piece of info (the username) to be entered. However, it adds friction to the flow when the user has either confirmed their account on another device, or when they want to sign in with a different user.

I think it is best to ask the user to enter their username in when the app relaunches, but if you believe a different UX is right for your app you can choose to cache the username with a package like flutter_secure_storage as mentioned.

from amplify-flutter.

Jordan-Nelson avatar Jordan-Nelson commented on June 5, 2024

Hello @AmeenIzhac - Thanks for taking the time to open the issue.

The Get Current User API only returns the user if they are signed in. This API returns data that would not exist until after sign in, such as the SignInDetails.

Next time they open the app, you want Amplify to remember their username and that their account is unconfirmed so that you can check for this on start up and immediately navigate the user to a resend email confirmation screen.

What would your expectation be if the user did want to sign up/in with a new user? Would you expect their to be an API to clear out the user that is pending confirmation?

If you would like to always bring the user back to the confirm sign in page in this scenario you could store the user's username on the device using a package such as flutter_secure_storage.

I do want to note that signIn throws a UserNotConfirmedException if the account has not been confirmed. You can catch this and redirect the user to the confirm sign in page. I understand this is not exactly what you are looking for though.

from amplify-flutter.

AmeenIzhac avatar AmeenIzhac commented on June 5, 2024

@Jordan-Nelson - Sorry for the late response. Thanks for your suggestion about storing the username, I will do that insha Allah.

What would your expectation be if the user did want to sign up/in with a new user? Would you expect their to be an API to clear out the user that is pending confirmation?

And yes that is what I'd expect. Because I think the most likely case is that a user would want to continue their sign up, but in the rare case they want to sign up with a different account, I'd probably have a button they can press to clear the user and go back to sign up.

So consider a scenario of a user who registers but doesn't confirm their account. If they try to sign up, it will throw an exception that the user already exists. So you catch that and then prompt them to sign in. But then when they try to sign in it will throw a UserNotConfirmedException as you mentioned. So you catch that and send them an email verification link. They confirm their email, then you try to sign them in again using the email and password they entered and it should work this time.

That's the best user journey I can think of. This seems quite long winded to me, is that what's intended?

from amplify-flutter.

AmeenIzhac avatar AmeenIzhac commented on June 5, 2024

Ok thanks, you've convinced me there isn't any missing neccessary functionality, but don't you think it would be a useful feature for Amplify to store the previous user and whether or not they are verified for you so you don't need to catch exceptions or use fullter_secure_storage?

from amplify-flutter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.