AWS SDK (JavaScript)
I ported all of my users from a MSSQL DB to a AWS Cognito UserPool. Now I need to have each one of my Cognito users in my Identity pool. This needs to happen so I can move my user data into Cognito Sync's datasets.
Problem : I cannot move each cognito user in my userpool to my identity pool. I have searched the docs and I cannot seem to findout how to go about this.
I cannot log each user in because each user will need to reset their own password. (this is due to the way things are when porting users from a .csv file)
SOLVED
- I loop through users in a batch.
- Each user is converted to a Cognito User in a User Pool
- Once the Cognito User is successfully added, I then log that user in manually,
- Then I have to set the users password with a temp password
- Next I get the successful method called
- Inside the success method, I now have the user in the Identity pool because I logged the user in manually
- Now I get the users Identity ID
- Now I can set DataSets
- NEXT IMPORTANT I have to set the user back to "RESET REQUIRED"
- Then the loop continues and I process the next user in the batch
NOTE Make sure you do not have anything checked in you MFA portion in the Userpool or emails will be sent. Also emails are still sent in special circumstances. To get around this, I performed this task
- Change the users email to [email protected]
- All emails are sent to [email protected]
- when you are done with the user and all is well, change the users email back to the correct email.