Closed benja8151 closed 1 month ago
I think https://github.com/furaiev/amazon-cognito-identity-dart-2/commit/08e43d6686931d2890816cc3a86e83910e8b1c4a might be linked to this, because it seems email in username
field in CognitoUser
is replaced by user id in this step. Perhaps we could store original username (or key prefix) separately, for later use?
I prepared a quick PR where I store original email separately from username, but I don't have much experience with this package, so I'm not sure if it breaks some other flow. Login, session refresh and restore seem to work correctly though: https://github.com/furaiev/amazon-cognito-identity-dart-2/pull/257
@benja8151
you are correct, in the original package the keyPrefix
consist username or not from time to time.
We need to copy this logic, which should fix the issue.
Can you please update your PR based on amplify-js
?
This issue is stale because it has been open for 30 days with no activity.
Has there been an update on this? I'm now running into a similar issue
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.
I've noticed that whenever I login (with
authenticateUser
) a new device is registered in Cognito. I found out thatkeyPrefix
used incacheDeviceKeyAndPassword
andgetCachedDeviceKeyAndPassword
functions is not the same. This means thatgetCachedDeviceKeyAndPassword
function never successfully restores cached device.For illustration, I printed out
keyPrefix
used in both functions:The end of key prefix is email address in
getCachedDeviceKeyAndPassword
and Cognito username ingetCachedDeviceKeyAndPassword
.I'm using email as username when creating
CognitoUser
on login, like so:Could this be a problem, since
keyPrefix
is constructed from username, and I'm guessing username is set to email address when first callinggetCachedDeviceKeyAndPassword
: