Last Updated: Sep 4, 2024
Overview
This article is for admins who are trying to dynamically configure two different domains for the same application in two different languages using NextJS.
The issue is that they are using the same redirect URL in both domains.
Applies To
- Domain Configuration
- Multiple languages
- Next JS
Solution
There are a few options to solve this issue:
- 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
- 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 the redirect_uri is specified in handleLogout and handleCallback, all the AUTH0_BASE_URL has to do is match the protocol of the app - e.g., https for prod)