Open Closed

How to Switch the user in background using Linked user "Login as this account" API in micro service Blazor application #4880


User avatar
0
raju.thinnaluri@gmail.com created

Hi,

We implemented the Blazor app as a SaaS.

I have a user account in all the Tenants and Linked the accounts. able to switch tenants and able to access the data.

And i am as a SaaS user I should be able to access all the Tenants Data in Dashboard. am bale to get the all the Tenants data and showing in Dashboard.

But When I click on a link of the item am unable to read the data since am might in that record Tenant currently.

So when ever i click on link of the item before loading the details if the record not from current tenant then in background I should be switch the user related to that Tenant of record.

something like below, make use of the API's of "Login as this account" in linked users.

if (tenantid == Guid.Empty) tenantid = null;

        if (CurrentTenant.Id != tenantid)
        {      
           // TODO:
           //Switch the User          
        }

can you please help on this?

If you're creating a bug/problem report, please include followings:

  • ABP Framework version: v5.3.4
  • UI type: Blazor
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

1 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Hi,

    The link login API URL is /account/LinkLogin?SourceLinkUserId=xxx&SourceLinkTenantId=xxx........

    Parameters:

    • SourceLinkUserId: Should be the current user Id
    • SourceLinkTenantId: Should be the current tenant Id
    • SourceLinkToken
    • TargetLinkUserId: The user Id you want to switch
    • TargetLinkTenantId: The tenant Id you want to switch

    You can use the GenerateLinkTokenAsync method of IIdentityLinkUserAppservice to get the SourceLinkToken

Made with ❤️ on ABP v9.1.0-preview. Updated on December 13, 2024, 06:09