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:
5 Answer(s)
-
0
Hi,
May I ask, do you want to use the current user's credentials or the client credentials?
-
0
it is communication between microservices
client credentials should be enough but current user also also fine.
could you describe both options ?
-
0
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.
-
0
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?
-
0
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" } }