Open Closed

Configuring Multi-tenant Domain resolver for Vue JS app #9954


User avatar
0
rogercprops created

We have a Saas web application written in Vue JS that uses our Abp Microservice solution for the backend. Each tenant will have their own domain like https://client1.mydomain, https://client2.mydomain.dev, etc.

We added this to the auth server module PreconfigureServices PreConfigure(options => { options.EnableWildcardDomainSupport = true; // Development environment domains options.WildcardDomainsFormat.Add("https://{0}.mydomain.dev/signin-oidc"); options.WildcardDomainsFormat.Add("https://{0}.mydomain.dev/silent-refresh"); options.WildcardDomainsFormat.Add("https://{0}.mydomain.dev/auth/login"); options.WildcardDomainsFormat.Add("https://{0}.mydomain.dev/auth/signout-callback-oidc"); });

In the Identity database OpenIddictApplications table we manually updated the RedirectUris and PostLogoutRedirectUris with the wildcard character '*'

[
{
"id": "9335f213-8a0d-7ce3-f069-3a1b786183db",
"ClientId": "CloverleafCMS",
"RedirectUris": "["https://*.mydomain.dev/signin-oidc","https://*.mydomain.dev/auth/silent-refresh"]",
"PostLogoutRedirectUris": "["https://.cloverleafcms.us/auth/login"]"

}

]

The issue is that the OpenIddictApplications table is reseeded every time the Identity service is restarted. So we have to manually update the redirect Uris with the wildcard manually

I tried adding the wildcard in the Identity data seeder but it through a malformed url error.

I read this article https://abp.io/docs/latest/guides/ms-multi-tenant-domain-resolving but not sure that will fix our problem since our client application is written in Vue.

How do we get around this? <br>


3 Answer(s)
  • User Avatar
    0
    AI-Bot created
    Support Team ABP Agent

    To properly configure multi-tenant domain resolution for your Vue.js app using the ABP microservice backend, you should leverage ABP's wildcard domain support for OpenIddict, as described in the official documentation. This approach is independent of the frontend framework (Vue, Angular, etc.) and is handled entirely on the backend (AuthServer).

    Here’s how to set it up so you do not need to manually update the OpenIddictApplications table after each reseed:

    1. In your AuthServer module's PreConfigureServices, enable wildcard domain support and add your domain formats:
    PreConfigure<AbpOpenIddictWildcardDomainOptions>(options =>
       {
           options.EnableWildcardDomainSupport = true;
           options.WildcardDomainsFormat.Add("https://{0}.mydomain.dev");
           // Add other formats as needed, e.g.:
           // options.WildcardDomainsFormat.Add("https://{0}.mydomain.dev/signin-oidc");
           // options.WildcardDomainsFormat.Add("https://{0}.mydomain.dev/auth/silent-refresh");
           // etc.
       });
    
    1. In your AuthServer's appsettings.json, add the wildcard domain formats:
    "WildCardDomains": {
         "VueApp": "https://{0}.mydomain.dev"
       }
    

    Then, in PreConfigureServices, load these from configuration:

    var configuration = context.Services.GetConfiguration();
       PreConfigure<AbpOpenIddictWildcardDomainOptions>(options =>
       {
           options.EnableWildcardDomainSupport = true;
           options.WildcardDomainsFormat.Add(configuration["WildCardDomains:VueApp"]);
       });
    
    1. Do NOT manually edit the OpenIddictApplications table to add wildcards. Instead, ensure your OpenIddict client seeding (usually in your data seeder or migration) does NOT hardcode tenant-specific redirect URIs. The wildcard support will allow any subdomain matching the pattern to be accepted for redirect and post-logout URIs.

    2. When seeding clients, use a base URL (e.g., "https://{0}.mydomain.dev") in your configuration, and let the wildcard domain support handle the rest. You do not need to list every possible tenant domain.

    3. This approach works regardless of your frontend technology (Vue, Angular, React, etc.), as the redirect URI validation is handled by the backend.

    4. If you are using multiple environments (dev, prod), add the appropriate domain patterns for each.

    By following these steps, you will not need to manually update the OpenIddictApplications table after each reseed, and your multi-tenant Vue.js app will work seamlessly with ABP's domain-based tenant resolution.

    Sources:


    This response was generated by AI. If it didn’t solve your problem, feel free to post a new answer — our support team will jump in to help you soon.

  • User Avatar
    0
    rogercprops created

    We've already done the above. We added "https://{0}.mydomain.dev/" to the appsettings in the Identity service and it threw an error that it's a malformed url in the CreateOrUpdateApplicationAsync of OpenIddictDataSeeder.cs.

  • User Avatar
    0
    maliming created
    Support Team Fullstack Developer

    hi

    What error/exception did you get now?

    Thanks.

Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v10.1.0-preview. Updated on October 02, 2025, 08:00