Amazon Cognito set identityId using developer authentication Obj C
<p>I am trying to authenticate my user using Cognito and developer authenticated Identities. My question is how do I set the identityId to the correct one returned from my developer backend in iOS using objective-c?</p>

<p>If I make the calls manually in the code or using postman the correct id is returned by my server and Cognito recognizes it and correctly swaps the tokens. </p>

<p>The iOS framework seems to be self assigning an identityId that is not correct. I am really struggling to understand the documentation as much of it is outdated and vague. </p>

<p>Here is my code below:</p>

<pre><code>NSLog(@"Complete login");

    NSMutableDictionary *merge = [NSMutableDictionary dictionaryWithDictionary:self.credentialsProvider.logins];
    [merge addEntriesFromDictionary:logins];

    self.credentialsProvider.logins = merge;

    // Force a refresh of credentials to see if we need to merge
    task = [self.credentialsProvider refresh];

    NSLog(@"Complete login 2-- %@", self.credentialsProvider.identityId); //The identityId assigned is incorrect...
    NSLog(@"Complete login 2-- %@", self.credentialsProvider.identityPoolId); //The identityPoolId is correct
</code></pre>

<p>SOME CLARITY BELOW:
This is how it works so far: 
1 - When the app runs its automatically assigns a random identityId from amazon (So the user is initially unauthenticated).
2 -The user enters their credentials then my code does a URL request to my backend which returns a valid token and the correct identityId for the username and password.
3 -Now this new identityId needs to be initialized in the code somehow to override the old unauthenticated identityId. 
4 -The new idendityId and token which returned from my server need to be sent to Cognito for final authentication and Cognito returns more authentication. When I say manually I am send the request via postman.</p>

<p>In short: 
1: How do I change/set my identityId?
2: How do I send the updated credentials received from my back end in my client to Cognito?  </p>