Is there something similar to iOS's .webAuth(clientId, domain) for React Native Android?

I can see that the iOS SDK can tell which clientId and domain to use for the .webAuth() function, and I am wondering if there’s something similar for React Native Android’s .authorize() function. From what I’ve seen in the documentation, there isn’t but I decided to ask here anyway.

My goal is to have a separate tenant for each environment I have, and to be able to switch between the different tenants at runtime…

Hello,

For React Native, you can dynamically configure your Auth0 instance by creating an instance of the Auth0 client with different clientId and domain based on your environment. Here’s how you can achieve this:

Install the Auth0 SDK: HealthCareGov
Make sure you have the Auth0 SDK installed in your React Native project.

npm install react-native-auth0

Create a Function to Initialize Auth0:
You can create a function to initialize the Auth0 client with dynamic parameters.

import Auth0 from 'react-native-auth0';

const getAuth0Instance = (clientId, domain) => {
  return new Auth0({
    clientId: clientId,
    domain: domain,
  });
};

Switch Between Environments:
Use the function to switch between different environments at runtime. You might store the configurations in a secure and manageable way, such as environment variables, a configuration file, or remote config.

const environments = {
  development: {
    clientId: 'YOUR_DEV_CLIENT_ID',
    domain: 'YOUR_DEV_DOMAIN',
  },
  production: {
    clientId: 'YOUR_PROD_CLIENT_ID',
    domain: 'YOUR_PROD_DOMAIN',
  },
};

const getEnvironmentConfig = (env) => {
  return environments[env] || environments.development;
};

// Example usage
const env = 'development'; // This can be dynamically set based on your app logic
const { clientId, domain } = getEnvironmentConfig(env);
const auth0 = getAuth0Instance(clientId, domain);

// Use `auth0` for authentication
auth0.webAuth
  .authorize({ scope: 'openid profile email' })
  .then(credentials => console.log(credentials))
  .catch(error => console.log(error));

By dynamically setting the clientId and domain based on your environment, you can manage multiple tenants effectively in a React Native application.

If I were to use this method, I won’t be able to use the hooks right?