Customer try to dynamically configure two different domains for the same application, on two different languages. They were using Next JS. The issue is that they are using the same redirect URL in both domains.
You have a couple of options:
- You can configure multiple instances of the Next SDK using initAuth0 rather than environment variables
- Configuring multiple Auth0 applications at run time · Issue #600 · auth0/nextjs-auth0
- You can continue to use environment variables and supply a different redirect_uri to handleLogin and handleCallback depending on the domain
- Allow setting redirect_uri at runtime on the callback handler just like it’s allowed on the login handler by mariano · Pull Request #298 · auth0/nextjs-auth0 (if you specify the redirect_uri in handleLogout and handleCallback all AUTH0_BASE_URL has to do is match the protocol of your app - for example https for production)