Developers would like to reconfigure Amplify at runtime
A customer is developing an app using TWO Cognito User Pools. Customer develops a web app, an Android app and an iOS App.
On their web app, they are able to call Amplify.configure(configuration); with one config (Cognito User Pool) or the other, depending on the URL of the app being used.
But on Mobile, it seems that once configured, they can not switch to another configuration by calling Amplify.configure(configuration); a second time.
There is a global configuration lock defined here https://github.com/aws-amplify/amplify-android/blob/master/core/src/main/java/com/amplifyframework/core/Amplify.java#L74
and used here https://github.com/aws-amplify/amplify-android/blob/fdb36b4cda6e513a0f4bf90e30bf1798438f1eaa/core/src/main/java/com/amplifyframework/core/Amplify.java#L125
I also raised an issue against amplify-ios : https://github.com/aws-amplify/amplify-ios/issues/527
Related to https://github.com/aws-amplify/amplify-android/issues/215
Hello,
Same issue: on our project we have 2 differents “pools” of users within the same application. Not the same usernameAlias (phone_number & email, this is possible in Cognito (no problem) Not the same password policies, one with MFA and the other one without Not the same required attributes Not the same legal constrains
Finally we don’t use the same behavior for cognito triggers. We are trying to update the project to use only 1 user pool, but it requites a lot of concessions. The main issue is about the authorizations management: Profiles don’t have the same S3 access, DynamoDB access and the worst point: API Gateway endpoints authorizations. We are using API Gateway + Lambda (classic) with a JWT authorizer. On 35 API endpoints, we have only 3 commons endpoints. So we need to add about 30 lines (31 exactly) of codes on each Lambdas (or using a common custom Lambda for authorizations but it’s the same pain with more lines to maintain) on all our endpoints to check the profile. The main issue is about latency & pricing: ~40-110ms to retrieve the “profile” attribute, check-it and return an error to the end-user. Off course those “ms” are billed.
On top of those issues, with only 1 user pool we are not able to provide 2 different accounts for the same user (They don’t have the same pricing plans, in fact it’s possible but with a bad user experience: sign out, sign in, sign out, sign in...)
We did our backend development with the JavaScript SDK (which work very well with 2 user pools) and now we are doing the “final implementation” on iOS and Android and it’s an hard start for the project.
Thank you in advance for your feedbacks.
This is also something we are looking for on my project. When considering a disaster recovery solution, if a region goes down we would like to be able to reconfigure the application to point to a pool in a different region and have the user login again. It would be preferable if we didn't have to rely on the user correctly restarting the app in this situation and could reconfigure at runtime.
Would being able to reconfigure amplify allow us to also update DataStore syncExpressions?
for example I might start the app with the syncExpression Post.RATING.gt(5) but at runtime I might want to change that expression to be Post.STATUS.eq("ACTIVE")
Using one user pool is not an option for us with our current setup and changing this setup with our third-parties is not ideal for anyone involved. This use case is outlined here: https://docs.aws.amazon.com/cognito/latest/developerguide/bp_user-pool-based-multi-tenancy.html
Greetings to all!
Any news here?
Having to ask the user to open the app again because they want to sign into a new pool is disgraceful and distasteful user experience.
Any update on when is this getting implemented?
I have no updates at this time. However, I will relay concerns to our product team, understanding this is a commonly requested feature.
@tylerjroach Hi!
There's another issue which demands to call Amplify.configure more than once.
There's a problem with configuring AWS lambda auth for DataStore (GraphQL API). The current implementation demands to provide an auth token in AWSApiPlugin configuration which is followed by Amplify.configure call.
As far as we can't call Amplify.configure more than once in Android library, there's no option to provide a different auth token for AWSApiPlugin.
Please, look at my comment for more info and a code example https://github.com/aws-amplify/amplify-android/issues/1828
@yaroslav-v Responded on the other issue to keep this thread focused on feature request for multiple configures.