Multi auth0 client support in one project
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 flutter app already integrate with our own auth0 client and domain, now we need to integrate with a 3rd party's auth0.
In our app, we will require user to login with 3rd party's account and get the access token and use the token request to their service.
Seems current auth0-flutter only support one native app?
Describe the ideal solution
Is it possible to make auth0 can work with multi clients?
Alternatives and current workarounds
No response
Additional context
No response
Hi @jingjiewei , Thanks for raising this request. I would like to understand your use case a little more . You already have auth0 in your app but having difficulty while using a 3rd party auth0 client . Are you not able to login to this 3rd party client from your app ? Or are you having issue managing the token ? could you please explain a bit more Thanks
Hi @jingjiewei , Thanks for raising this request. I would like to understand your use case a little more . You already have auth0 in your app but having difficulty while using a 3rd party auth0 client . Are you not able to login to this 3rd party client from your app ? Or are you having issue managing the token ? could you please explain a bit more Thanks
Hi @pmathew92 , thanks for replying this.
In our app, we need to connect to 2 different auth0 tenants, and need to be able to renew both tokens, but current sdk doesn't support config 2 auth0 domain/schema.
For example, in android build.gradle
manifestPlaceholders += [auth0Domain: "YOUR_DOMAIN", auth0Scheme: "YOUR_SCHEME"]
we can only define one domain.
Our app's flow is:
- User login in with our own auth0, we get the token and setup the renew strategy
- Only when user use a particular feature, we ask user to login in to 3rd party's auth0, get the 3rd token then request their service.
Thank you.
Hi @jingjiewei ,
Thanks for clarifying this. I believe you are using a separate SDK for the third party login but not able to set the domain and scheme in the manifest . Would passing your redirectUrl as part of the WebAuth request work for you ?
Regarding supporting multiple domain, we don't haven an immediate plan for the same. I will keep this ticket open and create an internal ticket to track this.
Hi @pmathew92 , Thanks for your reply. For both login I'm using auth0-flutter. I created 2 Auth0 objects and tried to call it's own login().
auth0 = Auth0( auth0domain, auth0ClientId, ); auth0_3Party = Auth0( auth0_3Party_domain, auth0_3Party_ClientId ); auth0.webAuthentication().login() auth0_3Party.webAuthentication().login()
For auth0_3Party, I tired add the redirectUrl in webAuthentication.login(), and add intent-filter in AndroidManifest.xml, but it's not working.
After the login, it can back to my app, but the code after webAuthentication.login() not executed.
I think I can manually use api call(/authorize, /oauth/token) and customized deep link to manage the 3rd auth0 token now.
https://auth0.com/docs/get-started/authentication-and-authorization-flow/authorization-code-flow
@jingjiewei , does manually using the api working for you ?
Hi @pmathew92 Yes, 3rd auth0, I use api instead of auth0-flutter sdk, seem get token and refresh token both works fine
@jingjiewei Glad to hear you are unblocked for the time being. As discussed above , I will keep this thread open for tracking this feature request
@jingjiewei ,
As a workaround you can also add the intent filter for both the Auth0 client within the manifest of your application by ignoring the existing RedirectActivity intent filters
something like:
<activity
android:name="com.auth0.android.provider.RedirectActivity"
tools:node="replace"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data
android:host="domain1"
android:pathPrefix="/android/${applicationId}/callback"
android:scheme="scheme1" />
<data
android:host="domain2"
android:pathPrefix="/android/${applicationId}/callback"
android:scheme="scheme2" />
</intent-filter>
</activity>
This will let the SDKs RedirectActivity handle the url callback from the domain and schemes provided in the data nodes Please check this and let me know if this works for you or not