title: Auth with AWSCognitoIdentityProvider for working with DynamoDB
body: <p>I don't understand why my app crash when I use this code. But without it I can't work with DynamoDB - I have this errors in my debug</p>
  
  <p>Error: The operation couldn’t be completed. (com.amazonaws.AWSCognitoIdentityErrorDomain error 0.)</p>
  
  <p>Error Domain=com.amazonaws.AWSServiceErrorDomain Code=6 "(null)" UserInfo={__type=com.amazon.coral.service#AccessDeniedException, Message=User: arn:aws:sts:::assumed-role/production_auth_MOBILEHUB_/CognitoIdentityCredentials is not authorized to perform: dynamodb:GetItem on resource: arn:aws:dynamodb:eu-central-1::table/production-mobilehub}</p>
  
  <p><img src="https://i.stack.imgur.com/Re5en.png" alt="enter image description here"></p>
  
  <pre><code>    let credentialsProvider = AWSCognitoCredentialsProvider(regionType: .EUCentral1, identityPoolId: "MY_IDENTITY_POOL_ID")
      let configuration = AWSServiceConfiguration(region: .EUCentral1, credentialsProvider: credentialsProvider)
      AWSServiceManager.default().defaultServiceConfiguration = configuration
  
      credentialsProvider.getIdentityId().continueWith(block: { (task) -&gt; AnyObject? in
          if (task.error != nil) {
              print("Error: " + task.error!.localizedDescription)
          }
          else {
              // the task result will contain the identity id
              let cognitoId = task.result!
              print("Cognito id: \(cognitoId)")
          }
          return task;
      })
  
  
          credentialsProvider.setValue(AWSCognitoUserPoolsSignInProviderKey, forKey: Token.sharedInstance.tokenID)
  </code></pre>