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
187 stars 114 forks source link

Fixed a storage key issue #129 #130

Closed dgofman closed 3 years ago

dgofman commented 3 years ago

Another fix on line 594. Defined a local variable srp_username, otherwise you overriding user value.

furaiev commented 3 years ago

Thank you, I’ll review on Sunday-Monday

furaiev commented 3 years ago

@dgofman thank you, changes are available as of version 0.1.25+3

dgofman commented 3 years ago

@furaiev Thanks!

dgofman commented 3 years ago

@malkovro There are two issues. One is mine I didn't realize amazon-cognito-identity-dart-2/lib/src/cognito_user_pool.dart hardcoded and using the same key. In the second one we are initializing storage in two contractors:

https://github.com/furaiev/amazon-cognito-identity-dart-2/blob/master/lib/src/cognito_user.dart#L53 https://github.com/furaiev/amazon-cognito-identity-dart-2/blob/master/lib/src/cognito_user.dart#L69

https://github.com/furaiev/amazon-cognito-identity-dart-2/blob/master/lib/src/cognito_user_pool.dart#L44 https://github.com/furaiev/amazon-cognito-identity-dart-2/blob/master/lib/src/cognito_user_pool.dart#L64

In case you forgot to pass the same storage argument in one of them your 'lastUserKey' value will be always NULL. For this reason, I did not catch this problem before. (I am using custom SharedPreferences class) Now I am also dealing with this problem.

https://github.com/furaiev/amazon-cognito-identity-dart-2/pull/140