-
Notifications
You must be signed in to change notification settings - Fork 203
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
Dynamic Configuration Alternative to amplifyconfiguration.json #1662
Comments
Thanks for opening this @bbrodjes. Dynamically creating the a configuration is supported through the let authPlugin = AWSCognitoAuthPlugin()
try Amplify.add(plugin: authPlugin)
let configuration = AmplifyConfiguration(
auth: AuthCategoryConfiguration(
plugins: [
"awsCognitoAuthPlugin": [
"CredentialsProvider": [
"CognitoIdentity": [
"Default": [
"PoolId": "...",
"Region": "..."
]
]
],
"CognitoUserPool": [
"Default": [
"PoolId": "...",
"Region": "...",
"AppClientId": "..."
]
]
]
]
)
)
try Amplify.configure(configuration) It is important to note that we currently don't support runtime configuration changes after the initial |
Thank you for the quick reply. I integrated this into our app and we are receiving an unexpected error when fetching the session after a successful "Amplify.Auth.signIn". The only difference that I see is that I use the dynamic configuration to configure Amplify when I receive the error. The static configuration works without an issue. Our Static Configuration:
Our Dynamic Configuration:
Error is thrown when we fetch the session:
Our calls to Amplify.Auth.signIn and signUp succeed.
I am able to switch back to the static configuration using "Amplify.configure()" and it no longer fails. |
Thanks for these details @bbrodjes. |
Hi @atierian, any update on the dynamic config issue above? |
I haven't been able to reproduce the issue you're experiencing. Would it be possible for you to provide a minimal reproducible example (with confidential info removed)? If not, some insights or code examples showing when / how you're calling
|
I solved the issue. I put a print statement inside the config function while still using the
|
That's great! Thanks for the update. |
Hello,
I have been reading through the Amplify docs and trying things out and I see that the standard method of configuration is an "amplifyconfiguration.json" file in the app project.
We have multiple Cognito configurations on our server and we need to be able to dynamically create or update the Amplify Configuration based on API data. I am not seeing a documented way to achieve this using Amplify and I was hoping someone could help me out.
I see documentation for an in-memory object for use in the AWS Mobile SDK but we are trying to upgrade our app to use Amplify rather than the older libraries.
Any help would be greatly appreciated.
The text was updated successfully, but these errors were encountered: