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.
- Cognito User Pool (authenticates) User login
- Get CognitoID by configuring
AWSCognitoCredentialsProvider - 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.