title: Amazon Web Services : Error - The security token included in the request is invalid
body: <p>I have a developer authenticated identity set for Amazon Cognito us in my iOS app</p>
  
  <p>I have followed the tutorial in the documentation:
  <a href="http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-auth.html#create-an-identity-pool-that-supports-developer-authenticated-identities" rel="nofollow">Using Developer Authenticated Identities</a></p>
  
  <p>My backend is able to generate tokens and get identityIds with no problem.
  And I am able to initialize cognito in my iOS app as instructed.
  But I upon making a dynamoDb request I get the error </p>
  
  <pre><code>The security token included in the request is invalid
  </code></pre>
  
  <p>Cognito initialization Code:</p>
  
  <pre><code> MyIdentityProvider *identityProvider = [MyIdentityProvider new];
  [identityProvider setIdentityPoolId:COGNITO_POOL_ID];
  
  AWSCognitoCredentialsProvider *credentialsProvider  = [[AWSCognitoCredentialsProvider alloc]
                                                         initWithRegionType:AWSRegionUSEast1
                                                         identityProvider:identityProvider
                                                         unauthRoleArn:nil
                                                         authRoleArn:COGNITO_ROLE_AUTH];
  
  
  
  
  AWSServiceConfiguration *configuration = [AWSServiceConfiguration configurationWithRegion:AWSRegionUSEast1
                                                                        credentialsProvider:credentialsProvider];
  
  [AWSServiceManager defaultServiceManager].defaultServiceConfiguration = configuration;
  
  
  
  
  
  [[credentialsProvider getIdentityId] continueWithSuccessBlock:^id(BFTask *task){
  
   //In here I can see that everything is ok.
   //I have a token and cognitoId
   //But despite this, when I make requests I get "The security token included in the request is  invalid"
  
   return nil;
  }];
  </code></pre>
  
  <p>Does anyone know what I might be doing wrong ?</p>