Login in to the same application from different domains
-
General question:
We have a single application 'my-app-dev' in FusionAuth, our users are registered there. we use the OAuth authorization code grant flow to login.
When we developers work locally, our web app is available inlocalhost
, from there we can login by redirecting to
https://fusionauth.io/oauth2/authorize?client_id={app_id}&redirect_uri=http://localhost/oauth-callback&response_type=code&scope=offline_access&state=aaabbbccc
this works fine.
Now we have a shared test environment in a different domain, to login from there is very similar, we redirect to
https://fusionauth.io/oauth2/authorize?client_id={app_id}&redirect_uri=http://test-web-app.mydomain.com/oauth-callback&response_type=code&scope=offline_access&state=aaabbbccc
Now, when we have both
localhost
andtest-web-app.mydomain.com
open in the browser and we login into the former then we just need to refresh the latter and we appear logged in automatically.
While this does not seem unexpected, is undesirable for us at the moment. Is there a way to support independent login for our two domains without creating a new application?Thanks
-
@luis-b said in Login in to the same application from different domains:
While this does not seem unexpected, is undesirable for us at the moment. Is there a way to support independent login for our two domains without creating a new application?
A new application is probably the most straightforward solution here. What you are running into is that FusionAuth sees the user is already logged in in the second case (when you visit with the redirect_uri of test-web-app...) and so doesn't require you to authenticate again.
We often see people use different tenants or even instances for different environments (dev, test, prod) which resolves this issue.
-