How do we support multiple auth0 domains on Android in a React-Native project

Please include the following information in your post:

  • Which SDK this is regarding:
  • SDK Version: “react-native-auth0”: “^2.12.0”,
  • Platform Version: Android version 12
  • Code Snippets/Error Messages/Supporting Details/Screenshots:

Hello,

I’m working on an app that we allow users dynamically choose different Auth0 tenant which means we need to support more than one auth0Domain on the go.

In this document https://auth0.com/docs/quickstart/native/react-native/00-login, it seems we are hardcoding the auth0Domain in build.gradle manifestPlaceholders = [auth0Domain: “YOUR_DOMAIN”, auth0Scheme: “${applicationId}”]. This will make Auth0 callback for other auth0Domain fail.

Configure Android

Open your app’s build.gradle file (typically at android/app/build.gradle) and add the following manifest placeholders. The value for auth0Domain should be populated from your Auth0 application settings as configured above.

android {
    defaultConfig {
        // Add the next line
        manifestPlaceholders = [auth0Domain: "dev-*****.us.auth0.com", auth0Scheme: "${applicationId}"]
    }
    ...
}

How can we workaround this and support more auth0Domains?

Many thanks,

1 Like

I’m currently in the very same situation. Could you find a workaround?

Same problem here. Auth0 is very not flexible.

The following post may be helpful:

This is now supported in v4.0.0 of react-native-auth0. Checkout the example provided here.