I've been having some issues understanding the Amazon AWS Cognito Workflow for adding multiple login providers, here is some psedu code to demonstrate my questions:
{Code to get CognitoCachingProvider}
Device Cognito ID = A
{Code to get Google Token}
withLogin(Google Token)
if(Identity is changed)
identityListener(
Device Cognito ID = ID in Cognito Pool)
else(
Device Cognito ID = a;
cognitoprovider.setLogin (Google Token);
)
withLogin(Facebook Token);
if(identity is changed)(
*****Device Cognito ID = ID in cognito Pool;*****
cognitoprovider.setLogin(Google TOken);
cognitoprovider.refresh();)
else
(Cognitoprovider.setLogin(Facebook Token);
cognitoprovider.refresh();)
So my real question is in the second step. Let's say that I want to bind both Facebook and Google to a specific Cognito ID.
Three examples:
1) There is no Cognito ID assigned - assign Google+ and Facebook 2) There is a cognito ID assigned with Google and no Facebook - The acquisition of the Google Login should not affect the Cognito ID - The acquisition of the Facebook Login is simply added as another provider 3) There is no cognito ID assigned with Google but one with facebook: - The acquisition of the Google Login creates a new and separate cognito ID that is immediately overwritten by the Facebook Login Token's associated Cognito ID
Is that correct?
Yes, your understanding of the first two scenarios is correct. To throw more light on this, Amazon Cognito has two concepts when dealing with multiple providers: Linking and Merging. Linking is when on a single device you are logged in with provider A and already have an identityId and you login with provider B. In this scenario the identityId will remain the same and provider B will be linked to the existing identity. Now let us say that you are logged in with provider A on device X and with provider B on device Y. Both these end users(identities) will have their unique identityIds. Now if you login with provider A on device Y, it will result in merge of these two identities and return you an identityId which will have both providers associated with it. I hope this clears any confusion around using multiple providers.
Thanks,
Rachit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With