我一直在試圖爲我的用戶池用戶訪問AWS資源生成此「身份標識」。但一直不成功。AWS Cognito認證憑證IOS Swift 2.3 - 3(集成用戶池和身份池)
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
// Override point for customization after application launch.
//user pool configuration
let serviceConfiguration = AWSServiceConfiguration(
region: AWSRegionType.USWest2,
credentialsProvider: nil)
let userPoolConfiguration = AWSCognitoIdentityUserPoolConfiguration(clientId: K.COGNITO_USER_POOL_APP_CLIENT_ID, clientSecret: K.COGNITO_USER_POOL_APP_CLIENT_SECRET, poolId: K.COGNITO_USER_POOL_ID)
//create a pool
AWSCognitoIdentityUserPool.registerCognitoIdentityUserPoolWithConfiguration(serviceConfiguration, userPoolConfiguration: userPoolConfiguration, forKey: "UserPool")
self.pool = AWSCognitoIdentityUserPool(forKey: "UserPool")
self.credentialsProvider = AWSCognitoCredentialsProvider(regionType: .USWest2, identityPoolId: K.IDENTITY_POOL_ID, identityProviderManager: self.pool!)
let configuration = AWSServiceConfiguration(region: AWSRegionType.USWest2, credentialsProvider: self.credentialsProvider)
AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration
self.pool!.delegate = self
self.user = self.pool!.currentUser()
return true
}
這是所有在Integrating User pool with Cognito(Swift) Documentation.
給出而Android代碼說,有關傳遞「idToken」 &用戶羣中的URL登錄地圖,還有在SWIFT代碼中沒有提到這樣的事情。
到目前爲止,在用戶登錄應用程序後,我在Xcode的日誌窗口中獲得「AccessToken」&「IdToken」。
我需要做些什麼才能獲得身份驗證身份?糾正我,如果我做錯了..謝謝。