sudo
sudo

Reputation: 1658

Unauthenticated identites not mapping to Developer Authenticated Identity

When a user launches the app they are an unauthenticated user and they receive a unauthenticated cognito identity supplied from the DeveloperAuthenticatedIdentityProvider class in the iOS app. I can see that unauthenticated cognito identity in the cognito console. However, when they login and I make a call to my nodejs backend with a logins map of:

{
   DevAuthIdentityLogin:<username>
}

and using this backend code:

getCognitoIdentity: function(logins, cognitoId, error) {
        var cognitoidentity = new AWS.CognitoIdentity(awsOptions);

        var params = {
            IdentityPoolId: identityPool,
            Logins: logins,
            TokenDuration: (60 * 5)
        };

        cognitoidentity.getOpenIdTokenForDeveloperIdentity(params, function(err, data) {
            if (err) {
                console.log(err, err.stack);
                error(err)
            } else {
                console.log(data);           // successful response
                cognitoId(data);
            }
        });
    }

It creates a new identity id with the developer authenticated identity and I can see that in the cognito console, but the old unauthenticated one is not being mapped to this new developer authenticated one.

Do I need to supply the unauthenticated identity id in the logins map when making a call to my backend to associate the two? OR am I not making this call correctly. I need some clarification on how to map/merge these identities please.

Upvotes: 1

Views: 136

Answers (1)

Bob Kinney
Bob Kinney

Reputation: 9030

I already answered your question on our forums, but you need to include the unauth identitity id as a parameter to the GetOpenIdTokenForDeveloperIdentity call, otherwise Amazon Cognito will have no way of knowing that it should associate your user identifier to that identity.

Upvotes: 1

Related Questions