title: AWS Cognito User Pool Integration With Identity Pool
body: <p>I am trying to implement login/ sign up functionality to my iOS app using a User Pool and Identity Pool. The problem I am having is that all of the users in my user pool are receiving the same identity pool id when they call getIdentityId on the credentials provider. I cannot figure out how to remedy this. Any help would be much appreciated.</p>
  
  <p>code in App Delegate:</p>
  
  <pre><code>var pool: AWSCognitoIdentityUserPool?
  var credentialsProvider: AWSCognitoCredentialsProvider?
  var dynamoMapper: AWSDynamoDBObjectMapper?
  
  @UIApplicationMain
  class AppDelegate: UIResponder, UIApplicationDelegate {
  
  var window: UIWindow?
  
  
  func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -&gt; Bool {
  // Override point for customization after application launch.
  
  let serviceConfiguration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: nil)
  
  AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = serviceConfiguration
  
  let userPoolConfiguration = AWSCognitoIdentityUserPoolConfiguration(clientId: "", clientSecret: "" , poolId: "")
  
  AWSCognitoIdentityUserPool.registerCognitoIdentityUserPoolWithConfiguration(serviceConfiguration, userPoolConfiguration: userPoolConfiguration, forKey: "UserPool")
  
  pool = AWSCognitoIdentityUserPool(forKey: "UserPool")
  
  credentialsProvider = AWSCognitoCredentialsProvider(regionType: .USEast1, identityPoolId: "", identityProviderManager: pool)
  
  let configuration = AWSServiceConfiguration(region: .USEast1, credentialsProvider: credentialsProvider)
  
  AWSServiceManager.defaultServiceManager().defaultServiceConfiguration = configuration
  
  dynamoMapper = AWSDynamoDBObjectMapper.defaultDynamoDBObjectMapper()   
  
  return true
  }
  </code></pre>
  
  <p>code in sign in view controller:</p>
  
  <pre><code>let user = pool!.getUser(self.email.text!)
  user.getSession(self.email.text!, password: self.password.text!, validationData: nil, scopes: nil).continueWithExecutor(AWSExecutor.mainThreadExecutor(), withBlock: { (task: AWSTask) -&gt; AnyObject? in
  
      if (task.error == nil) {
  
          credentialsProvider!.getIdentityId().continueWithBlock({ (task1: AWSTask) -&gt; AnyObject? in
              if (task1.error != nil) {
  
                  print("error on login")
  
              } else {
  
                  print("succesful login")
              }
              return nil
          })
  
  
      } else {
          print("error")
      }
      return nil
  })
  </code></pre>