react-native-auth0 icon indicating copy to clipboard operation
react-native-auth0 copied to clipboard

Supporting multiple domains in the SDK

Open chrisbruford opened this issue 9 months ago • 8 comments

Checklist

Description

Create a new Auth0Provider with a different domain prop still results in directing users to the initial domain when using the authorize method provided by useAuth0 hook.

Worked on 2.17.4

Reproduction

  1. Initialise the Auth0Provider with any valid domain prop
  2. Initialise a new Auth0Provider with a new valid domain prop
  3. Observe that the login function provided by useAuth0 still directs the browser to the initial domain

Additional context

We use multiple Auth0 Tenants to isolate users from different customers and in our React Native app we allow the user to select which customer they are from and thus we dynamically change the domain being sent to the Auth0 SDK.

This worked well up until we upgraded to v3 and now it fails to change the domain. I have traced it through the auth0 SDK and found the domain change is successfully being propogated all the way to the NativeModule import; but the SDK still directs the browser window to the previously set domain. Seems like the domain gets cached somewhere (perhaps the useAuth0 hook using the old object?)

I understand that Organisations is the recommended approach to this use case now; but the use of auth0 tenenants is still listed as a supported method - and thus I believe this change to be a bug.

Note: this has already been asked on the forums but no answer has been given for over a year

react-native-auth0 version

3.0.1

React Native version

0.72.5

Expo version

49.0.0

Platform

Android

Platform version(s)

13

chrisbruford avatar Oct 02 '23 18:10 chrisbruford