Open Closed

How to call abp vnext dynamic api #171


User avatar
0
BennieMok created

Hi, I created a winform project that used .net framework 4.7 version. I can't update .net core version because my customer used old windows version. I has to have both XXXX.Application.Contracts.dll and XXXX.HttpApi.Client.dll reference on this project.But it doesn't work. Any idea? Are there any relevant samples? Thank you.


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

    Hi BennieMok,

    See https://github.com/abpframework/abp/pull/2867. You can change HttpApi.Client project target to netstandard2.0.

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    I created an internal issue for this, will be available in the next version.

  • User Avatar
    0
    BennieMok created

    Ok,Thanks.

  • User Avatar
    0
    BennieMok created

    Hi liangshiwei , I made a action like this

      var configuration = new IdentityClientConfiguration(
               "https://localhost:44338/",
               "EasyCrm",
               "EasyCrm_App",
               "1q2w3e*",
               "password",
               userName,
               password
           ); 
            var accessToken = await AuthenticationService.GetAccessTokenAsync(configuration);
            
    

    And then I try to login as a tenant user, but it always returns:invalid_username_or_password.Only host user can login. I just hope to login as a tennat user(by a token).could you please give me some more detailed tips?

  • User Avatar
    0
    liangshiwei created
    Support Team Fullstack Developer

    Try:

    var client = new HttpClient();
    var disco = await client.GetDiscoveryDocumentAsync(_configuration["IdentityClients:Default:Authority"]);
    if (disco.IsError)
    {
        Console.WriteLine(disco.Error);
        return;
    }
    
    client.DefaultRequestHeaders.Add(TenantResolverConsts.DefaultTenantKey,<tenant>);
    
    // request token
    var tokenResponse = await client.RequestPasswordTokenAsync(new PasswordTokenRequest
    {
        Address = disco.TokenEndpoint,
        ClientId = _configuration["IdentityClients:Default:ClientId"],
        ClientSecret = _configuration["IdentityClients:Default:ClientSecret"],
        UserName = _configuration["IdentityClients:Default:UserName"],
        Password = _configuration["IdentityClients:Default:UserPassword"],
        Scope = _configuration["IdentityClients:Default:Scope"]
    });
    
  • User Avatar
    0
    BennieMok created

    Ok,But It seems not a good idea.I suggest you add the new property 'tenantId' in the class named IdentityClientConfiguration.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 v9.3.0-preview. Updated on May 15, 2025, 10:28