0
votes

I see this in the docs:

Using Amazon Cognito User Pools

Follow the instructions in Authentication Flow to authenticate users.

After the user is authenticated, add that user's identity token to the logins map in the credentials provider. The provider name will depend on your Amazon Cognito user pool ID. It will have the following structure:

cognito-idp.<region>.amazonaws.com/<YOUR_USER_POOL_ID>

The value for will be the same as the region in the User Pool ID. For example,

cognito-idp.us-east-1.amazonaws.com/us-east-1_123456789

Objective-c

AWSServiceConfiguration *serviceConfiguration = [[AWSServiceConfiguration alloc] initWithRegion:AWSRegionUSEast1 credentialsProvider:nil];
AWSCognitoIdentityUserPoolConfiguration *userPoolConfiguration = [[AWSCognitoIdentityUserPoolConfiguration alloc] initWithClientId:@"YOUR_CLIENT_ID"  clientSecret:@"YOUR_CLIENT_SECRET" poolId:@"YOUR_USER_POOL_ID"];
[AWSCognitoIdentityUserPool registerCognitoIdentityUserPoolWithConfiguration:serviceConfiguration userPoolConfiguration:userPoolConfiguration forKey:@"UserPool"];
AWSCognitoIdentityUserPool *pool = [AWSCognitoIdentityUserPool CognitoIdentityUserPoolForKey:@"UserPool"];
AWSCognitoCredentialsProvider *credentialsProvider = [[AWSCognitoCredentialsProvider alloc] initWithRegionType:AWSRegionUSEast1 identityPoolId:@"YOUR_IDENTITY_POOL_ID" identityProviderManager:pool];

How do we add the cognito-dip... to the logins map? Is the objective-c code below enough? I have the token from my lambda function.

The documentation is from here: http://docs.aws.amazon.com/cognito/latest/developerguide/amazon-cognito-integrating-user-pools-with-identity-pools.html

Thanks.

1
That docs link you referenced should be the absolute source for this, yes. - Jeff Bailey

1 Answers

0
votes

You need to set the login map: here is twitter example. But instead of "www.digits.com" you are going to use "cognito-idp.us-east-1.amazonaws.com/us-east-1_123456789" and the value would be the JWT that you get when the user log in.