Open Closed

Resolve TenantName from CLI #1637


User avatar
0
JonasP created
  • ABP Framework version: v4.3.2
  • UI type: Angular
  • DB provider: EF Core
  • Tiered (MVC) or Identity Server Separated (Angular): yes
  • Exception message and stack trace:
  • Steps to reproduce the issue:"

I am referring to the support question https://support.abp.io/QA/Questions/53/Login-From-Desktop-Client. I'm writing a CLI project where the client enters username, password and tenantname to login. To login the correct user i have to get the TenantID by name before any user is logged in. To complete the task, I need to find an AppService that I can use to resolve Tenant-Name to tenant-ID (to be called from the CLI via HTTP) - like the login view.


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

    HI,

    You mean use CLI to send a Http request to app service, right?

    See: https://docs.abp.io/en/abp/latest/Multi-Tenancy#tenant-resolvers

    Pass the tenant in the query string:

    httpClient.RequestTokenAsync(new TokenRequest()
    {
        Address = "https://demo.identityserver.io/connect/token?__tenant=xxx", pass the tenant
    
        GrantType = "password",
    
        ClientId = "client",
        ClientSecret = "secret",
    
        Parameters =
        {
            {"username", "xxx"},
            {"password", "xxx"}
        }
    });
    
Made with ❤️ on ABP v9.1.0-preview. Updated on December 12, 2024, 07:15