Create a new instance of Auth0 to use different login environment
Checklist
- [X] I have looked into the Readme, Examples, and FAQ and have not found a suitable solution or answer.
- [X] I have looked into the API documentation and have not found a suitable solution or answer.
- [X] I have searched the issues and have not found a suitable solution or answer.
- [X] I have searched the Auth0 Community forums and have not found a suitable solution or answer.
- [X] I agree to the terms within the Auth0 Code of Conduct.
Describe the problem you'd like to have solved
Our system has different Auth0 tenants for different environments: QA, Stage, Production We would like to re-initialize our auth0 client when the user selects a different environment. We currently do this, but discovered that Auth0 retains some settings from the first environment.
Example:
- start app
- select QA environment
- logout
- select Production environment
- login
This all works until the access token expires. The call to renew the token goes to the QA environment instead of Production. There must be a singleton or something inside auth0 that does not get cleaned up when we re-initialize the environment.
Describe the ideal solution
Auth0 client should be able to fully dispose and allow the app to create a new instance.
Alternatives and current workarounds
No response
Additional context
No response
Update: We're planning to support this as a part of the next major version that we're actively working on. The release is tentatively planned for mid Jan.
Update: We're planning to support this as a part of the next major version that we're actively working on. The release is tentatively planned for mid Jan.
Hi @brth31 . Thank you for your positive approach. We are facing the same issue and would be happy to hear from you when you have an update on the expected release date.
By the way, would it be possible to change storeKey when instantiating the CredentialsManager?
In the Native code, we can specify the storeKey like this:
// ex. Auth0.swift
let authenticationX = Auth0.authentication(clientId: "aaaaa", domain: "x.example.com")
let credentialsManagerX = CredentialsManager(authentication: authenticationX, storeKey: "tenant-x")
let authenticationY = Auth0.authentication(clientId: "bbbbb", domain: "y.example.com")
let credentialsManagerY = CredentialsManager(authentication: authenticationY, storeKey: "tenant-y")
We use this function to connect to multiple tenants with a single app. We hope that Flutter SDK will also allow to change storeKey in this way.
@tmorone-rezi Are you observing this on both iOS and Android devices ? @shusuke0812 Will plan to add this as part of our upcoming release
@tmorone-rezi Are you observing this on both iOS and Android devices ? @shusuke0812 Will plan to add this as part of our upcoming release
Yes ios and android
@brth31 would this also include signing with multiple accounts (on the same/different envs)?
@Xylez01 , Do you mean login with different user accounts on the same device, using the same or different tenant ?
@pmathew92 Ideally both. So different user accounts on the same device from either the same or different tenants.
Our app supports multi-account (mostly due to legacy) and internally we also have multiple environments, each with their own tenant I believe
@Xylez01 , thank you for clarifying that.