Open Closed

Dynamic C# API Client Proxies authentication #6047


User avatar
0
igoron761 created

How can I configure authentication options for remote services?

I configure remote service by follow code:

//Create dynamic client proxies context.Services.AddHttpClientProxies( typeof(FeedServiceApplicationContractsModule).Assembly, remoteServiceConfigurationName: "FeedService" );

but could not find solution to configure authentication options.

  • ABP Framework version: v7.4.0
  • UI Type: Angular / MVC / Blazor WASM / Blazor Server
  • Database System: EF Core (SQL Server, Oracle, MySQL, PostgreSQL, etc..) / MongoDB
  • Tiered (for MVC) or Auth Server Separated (for Angular): yes/no
  • Exception message and full stack trace:
  • Steps to reproduce the issue:
Markdown supported.
Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)

5 Answer(s)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    May I ask, do you want to use the current user's credentials or the client credentials?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    igoron761 created

    it is communication between microservices

    client credentials should be enough but current user also also fine.

    could you describe both options ?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    gterdem created
    Senior .NET Developer

    We've a documentation about communication between microservices: https://docs.abp.io/en/commercial/latest/startup-templates/microservice/synchronous-interservice-communication

    Essentially, you get to choose the authentication flow for this communication. Recommended way is using the client_credentials flow as in the samples. Or, you can use ResourceOwnerPassword flow where you need to define a user and the password to obtain the access token.

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    igoron761 created

    it help, thank you. but if I have several microservices and want to use different credentials. I added several sections to IdentityClients settings. how can I configure what credentials to use for specific remote service?

    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
  • User Avatar
    0
    liangshiwei created
    Fullstack Developer

    Hi,

    You can configure IdentityClients for different services

     "IdentityClients": {
        "Default": {
          "GrantType": "client_credentials", 
          "ClientId": "BookStore_OrderService",
          "ClientSecret": "1q2w3e*",
          "Authority": "https://localhost:44322", 
          "Scope": "ProductService"
        },
        "AbpIdentity":{
          "GrantType": "client_credentials", 
          "ClientId": "BookStore_OrderService",
          "ClientSecret": "1q2w3e*",
          "Authority": "https://localhost:44322", 
          "Scope": "IdentitytService"
        }
      }
    
    Markdown supported.
    Copy, paste, or drag & drop images and files (max 100 MB per file, 100 MB total per post)
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 v10.8.0-preview. Updated on September 16, 2026, 14:50
1
ABP Assistant
🔐 You need to be logged in to use the chatbot. Please log in first.