Amazon web services Cognito用户池中不同用户的相同标识Id
我在CognitoUserPool中创建了两个用户(来自XCode模拟器),如 然后,我期待联邦身份中的身份浏览器为每个用户分配不同的唯一身份id。不幸的是,只有一个标识id,两个不同的帐户使用的数据(在dataset中)与中相同。我也用了下面问题中提到的方法。但我仍然有一个问题 我的应用程序内代码委托Amazon web services Cognito用户池中不同用户的相同标识Id,amazon-web-services,amazon-cognito,swift4,Amazon Web Services,Amazon Cognito,Swift4,我在CognitoUserPool中创建了两个用户(来自XCode模拟器),如 然后,我期待联邦身份中的身份浏览器为每个用户分配不同的唯一身份id。不幸的是,只有一个标识id,两个不同的帐户使用的数据(在dataset中)与中相同。我也用了下面问题中提到的方法。但我仍然有一个问题 我的应用程序内代码委托 let serviceConfiguration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: nil)
let serviceConfiguration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: nil)
// create pool configuration
let poolConfiguration = AWSCognitoIdentityUserPoolConfiguration(clientId: "2xXx6X77x7X8YYyyy7X9",
clientSecret: "f87as68a7f68adf6sa897f79af789a7fda8a7sd698",
poolId: "us-east-1_XXXXXXXX")
// initialize user pool client
AWSCognitoIdentityUserPool.register(with: serviceConfiguration, userPoolConfiguration: poolConfiguration, forKey: "UserPool")
// fetch the user pool client we initialized in above step
let pool = AWSCognitoIdentityUserPool(forKey: "UserPool")
self.storyboard = UIStoryboard(name: "Main", bundle: nil)
pool.delegate = self
//SAVE & LOAD DATA TO AWS COGNITO SYNC
let credentialProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "us-east-1:xxxxxxx-xxxx-xxxx-xxxxxxxxx", identityProviderManager: pool)
let configuration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialProvider)
//credentialProvider.clearCredentials()
AWSServiceManager.default().defaultServiceConfiguration = configuration
我已尝试将
credentialProvider.clearCredentials()
添加到应用程序委托和注销函数中,但两者都无助于解决问题 尝试以下方法,看看是否能解决您的问题:
- 打电话。这将清除所有保存的值-凭据和标识ID。使用assert检查IdentityId是否已清除
assert(credentialsProvider.IdentityId==nil)
- 在进行同步调用之前,请使用
获取标识idcredentialsProvider.getIdentityId()
- 您如何注销您的用户?尝试使用signout()方法
- 默认情况下,SDK会记住最后一个已知的用户。如果需要,请使用
将其清除pool?.clearLastKnownUser()
- 调用Cognito sync客户端的方法来擦除缓存数据
- 打电话。这将清除所有保存的值-凭据和标识ID。使用assert检查IdentityId是否已清除
assert(credentialsProvider.IdentityId==nil)
- 在进行同步调用之前,请使用
获取标识idcredentialsProvider.getIdentityId()
- 您如何注销您的用户?尝试使用signout()方法
- 默认情况下,SDK会记住最后一个已知的用户。如果需要,请使用
将其清除pool?.clearLastKnownUser()
- 调用Cognito sync客户端的方法来擦除缓存数据
let user = pool?.currentUser()
user?.signOut()