Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Developers would like to reconfigure Amplify at runtime #560

Open
sebsto opened this issue Jun 5, 2020 · 10 comments
Open

Developers would like to reconfigure Amplify at runtime #560

sebsto opened this issue Jun 5, 2020 · 10 comments
Labels
core Amplify Core library feature-request Request a new feature

Comments

@sebsto
Copy link

sebsto commented Jun 5, 2020

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

"Be sure to only call Amplify.configure once"

I also raised an issue against amplify-ios : aws-amplify/amplify-swift#527

@jamesonwilliams
Copy link
Contributor

@aguigon
Copy link

aguigon commented Jun 8, 2020

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.

@ekmwilson
Copy link

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.

@PS-MS
Copy link

PS-MS commented Nov 1, 2021

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")

@codeversed
Copy link

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

@krrskl
Copy link

krrskl commented Aug 3, 2023

Greetings to all!

Any news here?

@sonic555gr
Copy link

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?

@tylerjroach
Copy link
Member

I have no updates at this time. However, I will relay concerns to our product team, understanding this is a commonly requested feature.

@yaroslav-v
Copy link

@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 #1828

@tylerjroach
Copy link
Member

@yaroslav-v Responded on the other issue to keep this thread focused on feature request for multiple configures.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Amplify Core library feature-request Request a new feature
Projects
None yet
Development

No branches or pull requests