You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Sep 16, 2020. It is now read-only.
My app allows user add data while unauthenticated with cognito sync. I want a situation where when a user logs in, it takes data it saved while user was unauthenticated and merges it with the data owned by the just authenticated user. How do I achieve this?
The text was updated successfully, but these errors were encountered:
I had this issue last year and found that it is actually a Cognito Identity issue. When you call the AWS.CognitoIdentityCredentials with the new user authenticated user it allocated you a new IdentityId.
So I retrieve the previously stored IdentityId from localStorage using hwIdentity = AWS.config.credentials.identityId; before I start the authentication process.
Then when I I retrieve the new credentials I pass it it as part of the parameters as follows: AWS.config.credentials = new AWS.CognitoIdentityCredentials({ 'IdentityPoolId': aws_cognito_identity_pool_id, 'IdentityId': hwIdentity, 'Logins': logins });
This causes CognitoIdentity to add the new user information to the Identity or merge Identities if their are 2, which will initiate the Cognito Sync merge process.
Hope this Helps.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
My app allows user add data while unauthenticated with cognito sync. I want a situation where when a user logs in, it takes data it saved while user was unauthenticated and merges it with the data owned by the just authenticated user. How do I achieve this?
The text was updated successfully, but these errors were encountered: