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"}
        }
    });
    
Boost Your Development
ABP Live Training
Packages
See Trainings
Mastering ABP Framework Book
Do you need assistance from an ABP expert?
Schedule a Meeting
Mastering ABP Framework Book
The Official Guide
Mastering
ABP Framework
Learn More
Mastering ABP Framework Book
Made with ❤️ on ABP v9.2.0-preview. Updated on March 25, 2025, 11:10