FusionAuth
    • Home
    • Categories
    • Recent
    • Popular
    • Pricing
    • Contact us
    • Docs
    • Login

    Login in to the same application from different domains

    Scheduled Pinned Locked Moved Solved
    Q&A
    2
    2
    1.1k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • L
      Luis B
      last edited by

      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 in localhost, 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 and test-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

      danD 1 Reply Last reply Reply Quote 0
      • danD
        dan @Luis B
        last edited by

        @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.

        --
        FusionAuth - Auth for devs, built by devs.
        https://fusionauth.io

        1 Reply Last reply Reply Quote 0
        • L Luis B has marked this topic as solved on
        • First post
          Last post