I need to be able to have a Cognito User Pool user, with the ability to link several different social providers to that user so they can either login using a email/password (basic cognito auth) or via their social account ('email' being the common data field/username).
The flow I currently have:
1) User clicks sign with Facebook, my app handles the oAuth handshake and eventually get the accessToken and email address
2) At this point I couldn't find a way to detect if the user was already registered in the User Pool, so I attempt a Login call with a random password and infer from the error response if the user doesn't exist at all.
3) If the user isn't registered, I redirect the user to registration page so they can provide a Password. Once confirmed, I call SignUp to create a regular cognito user (unverified).
From this point I am stuck.. How do I then associate the Facebook account to this newly created cognito user?
Note: As I'm using custom UI flow for this so using the HoC from aws-amplify-react-native library isn't possible.