amazon web services - AWS - Add identity provider for same Cognito Identity ID -


i using aws sdk, using federated identity providers cognito. right now, i'm doing this:

private void setupcognitostuff() {     _cognitocredentials = new cognitoawscredentials(         my_identity id, // identity pool id         _awsregion); // region      if (_identityprovidername != null)         _cognitocredentials.addlogin(_identityprovidername, _identityprovidertoken);      _identityid = getidentityid(); } 

this works fine create or retrieve user's credentials, using facebook identity provider. cache cognito identity id in app's settings.

so, let's next time user uses app, choose different login provider (let's google). i've cached cognito identity id last time logged in (via facebook). when instantiate cognitoawscredentials time, how tell want use existing cognito identity id, , google should added second identity provider, instead of creating whole new cognito identity?

looking @ the documentation raw api, should possible:

merging identities

if pass in token login not linked given identity, linked identity, 2 identities merged. once merged, 1 identity becomes parent/owner of associated logins , other disabled. in case, identity id of parent/owner returned. expected update local cache if value differs (this handled if using providers in aws mobile sdks or aws sdk javascript in browser).

so if case, how know (i.e. how tell it) existing identity id use when calling above function different identity provider?

from this page, looks can done via raw api calling getcredentialsforidentity , passing in existing identity id in "identityid" field , new identity provider info in "logins" field:

request syntax

{  "customrolearn": "string",  "identityid": "string",  "logins":       {          "string" :              "string"      }  } 

i'm not sure how translate sdk using cognitoawscredentials class.

update login map of credentials object provider 2 token once authenticated via provider 1. need update logins map of credentials object include google's one. figure out how done sdk. e.g. javascript,

aws.config.credentials.params.logins['accounts.google.com'] = googletoken; 

javascript reference


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -