I've created a small GRPC service in .NET core. The service has authentication enabled:
services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
.AddJwtBearer(options =>
{
options.Audience = config["AAD:Audience"];
options.Authority = config["AAD:Authority"];
});
I've also created a small client, that can connect to the service by adding a Bearer token, and it works fine. However if I call the service withour a token, I get an exception back, with the following message:
Status(StatusCode=Cancelled, Detail="Bad gRPC response. Expected HTTP status code 200. Got status code: 401")
Is there a (smart) way, to capture this server side and convert it into a GRPC payload, instead of getting an exception on the client??
TIA