Configuration of Cognito Identity Pools giving errors "cannot find module in scope" #536
Replies: 5 comments 3 replies
-
If you are only using Cognito to access AWS services you don't need Are you using a Cognito user pool to authenticate with? If so you can do the following Use a let userPoolId = "my user pool id"
let identityPoolId = "my identity pool id"
let identityProvider = "cognito-idp.<region>.amazonaws.com/\(userPoolId)"
let credential: CredentialProviderFactory = .cognitoIdentity(
identityPoolId: identityPoolId,
logins: [ identityProvider : "id token received from user pools authentication"],
region: .useast1
)
let client = AWSClient(credentialProvider: credential, httpClientProvider: .createNew) This client can then be used with any Soto service. let cloudWatch = CloudWatch(client: client, region: region) If you are using user pools for authentication you will have to call the Unfortunately there isn't any direct support for refreshing ids at the moment. I am just looking into this. You can do it yourself if you use the alternative
|
Beta Was this translation helpful? Give feedback.
-
As an aside I am working on a credential provider that will be part of SotoCognitoAuthenticationKit that does all the above. I have the starts of this inside Soto here. |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
As I understand it you need an Identity provider to authenticate with Cognito identity pools. This could be Cognito user pools, apple, amazon, google etc. They provide you with the values to stick in the Your The request structures you send to the AWS commands are meant to be temporary structures. You would create one just before calling the AWS command. Because all the member variables are How to access the response: The Here is the getting started guide to Soto which has a small section on asynchronous functions at the bottom https://soto.codes/getting-started.html. You should also checkout the swift-nio documentation on As an aside Soto now provides async/await functionality. So you can use the new Swift 5.5 concurrency features with it |
Beta Was this translation helpful? Give feedback.
-
Moving this across to discussions as it isn't really an issue |
Beta Was this translation helpful? Give feedback.
-
The bug
I was previously using Pods to send logs from Xcode to Cloudwatch Logs. But I am now trying to use Soto(swift package manager) instead of Pods.
In this project, I want to configure with an identity pool id, just as I did with Pods here:
So, I am using all the package products of the Soto Swift Packages and Soto Cognito Authentication Kit Swift Package to configure the identity pool:
But I keep getting these errors:
Questions
I would like to be able to configure my Cloudwatch AWS account with my identity pool id, the same way I did with the Pods.
Do I need to do any configuration in the terminal? I have already done configuration for AWS there.
Do I put my credentials in the AppDelegate.swift file the same way I did with Pods?
I'm also confused about when syncShutdown needs to be called? Does this happen at the end of the didFinishLaunchingWithOptions function?
Beta Was this translation helpful? Give feedback.
All reactions