问题: 我在Cognito中有两个用户池。我们将它们称为“池A”和“池B”。我能够成功验证用户的“池A”身份。
我需要将客户端动态创建的用户从客户端动态认证为“池B”。
我阅读的文档: *亚马逊扩大 *亚马逊Cognito *适用于iOS的Amazon SDK * AWSMobileClient
我的设置: * AWSMobileClient v2.9.8
我尝试了以下解决方案:
AWSMobileClient.sharedInstance()。signIn( 用户名:“ user_present_in_pool_a”, 密码:“密码” ){结果,错误
debugPrint(result, error)
// Async sign out
AWSMobileClient.sharedInstance().signOut(
options: .init(
signOutGlobally: true,
invalidateTokens: true
),
completionHandler: { error in
debugPrint(error)
// setup configuration for "Pool B"
let serviceConfig = AWSServiceConfiguration(
region: .USWest2,
credentialsProvider: nil
)
let poolConfig = AWSCognitoIdentityUserPoolConfiguration(
clientId: "pool_b_client_id", clientSecret: nil, poolId: "pool_b_id"
)
// init pool client
AWSCognitoIdentityUserPool.register(
with: serviceConfig,
userPoolConfiguration: poolConfig,
forKey: "some_key"
)
AWSMobileClient.sharedInstance().signIn(
username: "user_present_in_pool_b",
password: "password"
) { result, error in
debugPrint(result, error)
}
})
}
AWSMobileClient.Error(“无法使最终用户登录”)