Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Global accounts and workspaces #11724


User avatar
0
harley.mcphee created

Many modern SAAS products employ a global account system where an email is unique throughout the entire platform. Tenants invite users via their email, and once authenticated, users can select which tenant they wish to access.

For instance, in Notion, I can switch between three different workspaces (or tenants) that I either own or have been invited to. This allows me to access tenant-specific data.

Here's how another SAAS product does it, when I login I need to select which account (tenant) I want to access

By default, it seems aspnetzero doesn't support this feature. Has any client managed to implement a similar system using the platform?

In essence, the modification should be straightforward. We'd need to update the TenantId in the AbpUsers table to accommodate a list of TenantIds or introduce a new table capturing which tenants a user can access. The login process would then display available tenants for users to choose from. Upon selection, users are directed to the respective tenant's subdomain or provided with a tenant-specific cookie header.


5 Answer(s)
  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi,

    AspNet Zero has a linked accounts feature, see https://docs.aspnetzero.com/en/aspnet-core-angular/latest/Features-Angular-User-Menu#linked-accounts.

    A User can link another user account to his/her account and login via linked account. So, maybe you can automatically create linked accounts via invitation and use this feature. Does that work for you ?

  • User Avatar
    0
    harley.mcphee created

    Yeah this could work but will be a bit janky, the ideal setup would be for a user to just have one email & password and to login to the app and be able to switch between tenants.

  • User Avatar
    0
    m.aliozkaya created
    Support Team

    Hi @harley.mcphee,

    You can create a custom controller and update your user tenantId and it will change the user's tenant. And you could unique the email.

  • User Avatar
    0
    harley.mcphee created

    m.aliozkaya, the issue is the user needs to be associated with many tenants, not just one.

  • User Avatar
    0
    ismcagdas created
    Support Team

    Hi @harley.mcphee

    At the moment, you need to associate the user with many tenants as you said. You can create the same user in different tenants with the same password and email address.

    If you can create an issue on GitHub, we can enhance the linked accounts feature.