In the iOS AWSCore library one can authorize bespoke third-party auth systems into an AWS identity pool roughly as follows:
let myIdProvider = MyCustomIdProvider()
let credentialsProvider = AWSCognitoCredentialsProvider(regionType: AWSRegionType.USWest2, identityProvider: myIdProvider)
let configuration = AWSServiceConfiguration(region: AWSRegionType.USWest2, credentialsProvider:credentialsProvider)!
// which is then used for things like S3 access...
// The custom provider class...
class MyCustomIdProvider : AWSCognitoCredentialsProviderHelper {
override func token() -> AWSTask<NSString> {
// Do the verification here
}
}
I want to move this code to a cross-platform solution (in Dart/Flutter ideally but happy with a JS solution for now). How can I accomplish that in Amplify?
You can use the following steps, in short, you really not required the above code when working with AWS Cognito amplify API this API provides abstraction and make your life simple.
Following is an example in react.js
but you can use the same in your code as its using simple JavaScript, you can download and add your user pool details in config.json
and check in local
Code example:
https://github.com/vaquarkhan/aws-cognito-amplify-reactjs-poc/tree/main/src
https://docs.amplify.aws/lib/auth/getting-started/q/platform/js/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With