1
votes

So I have successfully authenticated user with User Pool in Cognito. By my understanding, now before we avail any AWS Services (dynamodb,S3 etc), again we need to get cognitoID from AWS Cognito Credential Provider.

  1. Cognito User Pool (authenticates) User login
  2. Get CognitoID by configuring AWSCognitoCredentialsProvider
  3. Make AWS cals to whichever service we want to interact with.

After success of login from User PoolID delegate, I do this

credentialProvider = AWSCognitoCredentialsProvider(regionType: 
AWS_Region_type, identityPoolId: AWS_IdentityPool_ID, 
identityProviderManager: devCredentialProvider)
let configuration = AWSServiceConfiguration(region: AWS_Region_type, credentialsProvider: credentialProvider)
 AWSServiceManager.default().defaultServiceConfiguration = configuration 

But everytime I get that the user is NOT authenticated. Now if the user is NOT authenticated, then I couldnt have logged in with Cognito User Pool. What am i doing wrong?

Please refrain yourself from giving resources of existing aws documentation, they are highly misleading.

Also AWS package from Cocoapods does not match that of the documentation, and does not store in keychain (the id token), hence my Sign in UI is opening everytime. There are two ways we can get the AWS SDK, through Cocoapods/ Carthage or from Mobile HUB in AWS Console. Now Its very confusing as to which one do i use?? I have also used the Mobile HUB's example project, but what if my backend(AWS console) is already setup and i need to implement only the front end?

Also my backend is setup on USEast2, but while creating a Mobile HUB project, there is NO USEast2.

If anyone can clear up what exactly I am doing wrong, it would be great as I have already wasted a ton of time on this with vain.

1
I have exactly the same problem. The mobileHub framework lacks documentation. Nothing describing properly how to use the different classes. How can AWS be that bad ! - user3239711

1 Answers

0
votes

The MobileHubHelper framework is deprecated and the AWS iOS SDK has the Auth SDK to manage authentication with AWS. It is recommended you use that. You can find the instructions here: https://docs.aws.amazon.com/aws-mobile/latest/developerguide/add-aws-mobile-user-sign-in.html

Thanks, Rohan