简体   繁体   中英

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.

我已经在我们的论坛上回答了您的问题,但是您需要将unauth identityity id用作GetOpenIdTokenForDeveloperIdentity调用的参数,否则Amazon Cognito将无法知道它将用户标识符与该身份相关联。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM