Can you write a call flow?
107295472 opened this issue · comments
- Definition
- Deployment
- Run
The HTTP status code of the response was not expected (401).\n\nStatus: 401\nResponse: \n{"timestamp":"2022-06-24T03:51:36.336+00:00","status":401,"error":"Unauthorized","path":"/flowable-ui/process-api/management/engine\
public string BaseUrlProcessApi { get; set; } = "http://rest-admin:test@192.168.10.21:8083/flowable-ui/process-api/";
Are you sure that flowable expects basic authentication? I guess that you need to authenticate diffrently. Usually, it is a bearer token, so in order to make it work you need to set up DelegatingHandler
luckily, there is an open-source project that helps with that:
https://identitymodel.readthedocs.io/en/latest/aspnetcore/web.html
See: .AddClientAccessTokenHandler(); AddAccessTokenManagement();
public static IServiceCollection AddFlowableHttpIntegration(
this IServiceCollection services,
IConfiguration configuration)
{
services.AddAccessTokenManagement(options =>
{
options.Client.Clients.Add("", <provider depending on your oidc flow>);
});
services.AddHttpClient<IFlowableProcessHttpClient, FlowableProcessHttpClient>(
options => options.BaseAddress = new Uri(flowableConfiguration.BaseUrlProcessApi))
.AddClientAccessTokenHandler();
return services;
}
thanks
Postman can, using this sdk is 401
To add header Authorization
Basic cmVzdC1hZG1pbjp0ZXN0
options.DefaultRequestHeaders.Add("Authorization", "Basic cmVzdC1hZG1pbjp0ZXN0");