Open
Description
Description
When configuring Amplify in a Flutter application with existing resources and specifying an Endpoint for CognitoUserPool, the SDK does not route Cognito calls through the provided endpoint. This behavior is unexpected, and was working before with v1.
Here's an example of the configuration passed for existing resources:
String amplifyconfig = ''' {
"UserAgent": "aws-amplify-cli/2.0",
"Version": "1.0",
"auth": {
"plugins": {
"awsCognitoAuthPlugin": {
"IdentityManager": {
"Default": {}
},
"CognitoUserPool": {
"Default": {
"PoolId": "${EnvVariables.cognitoUserPoolID.value}",
"AppClientId": "${EnvVariables.cognitoAppClientID.value}",
"Region": "${EnvVariables.awsRegion.value}",
"Endpoint": "${EnvVariables.awsCognitoEndpoint.value}"
}
},
"Auth": {
"Default": {
"authenticationFlowType": "CUSTOM_AUTH"
}
}
}
}
}
}''';
Categories
- Analytics
- API (REST)
- API (GraphQL)
- Auth
- Authenticator
- DataStore
- Notifications (Push)
- Storage
Steps to Reproduce
- Configure Amplify with existing resources, and specify an endpoint for CognitoUserPool:
String amplifyconfig = ''' {
"UserAgent": "aws-amplify-cli/2.0",
"Version": "1.0",
"auth": {
"plugins": {
"awsCognitoAuthPlugin": {
"IdentityManager": {
"Default": {}
},
"CognitoUserPool": {
"Default": {
"PoolId": "${EnvVariables.cognitoUserPoolID.value}",
"AppClientId": "${EnvVariables.cognitoAppClientID.value}",
"Region": "${EnvVariables.awsRegion.value}",
"Endpoint": "${EnvVariables.awsCognitoEndpoint.value}"
}
},
"Auth": {
"Default": {
"authenticationFlowType": "CUSTOM_AUTH"
}
}
}
}
}
}''';
- Add Cognito Auth plugin:
Amplify.addPlugin(
AmplifyAuthCognito(),
);
- Configure Amplify:
Amplify.configure(amplifyconfig);
- Try calling any Cognito method and check the network logs (Request is not made through the specified Endpoint):
Amplify.Auth.getPlugin(AmplifyAuthCognito.pluginKey).signUp(
username: username,
password: password
);
Screenshots
No response
Platforms
- iOS
- Android
- Web
- macOS
- Windows
- Linux
Flutter Version
3.27.1
Amplify Flutter Version
2.5.0
Deployment Method
Custom Pipeline
Schema
No response