Search⌘ K

Passing JWT from a gRPC Client

Explore how to configure both gRPC server and client in ASP.NET Core to securely pass JWT bearer tokens for authorized access to endpoints. Understand the process of setting up authentication middleware, generating tokens, and including them in gRPC metadata to secure inter-application calls.

We can access secure gRPC endpoints by passing a bearer token to them. The following playground demonstrates how a bearer token is passed from a gRPC client to a gRPC server:

{
  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft.AspNetCore": "Warning"
    }
  },
  "AllowedHosts": "*"
}
Secure gRPC communication with the OIDC flow

Note: Because we have to build two ASP.NET Core applications and populate the IdP database with the initial seed data, the build process is expected to take at least a few minutes.

The playground consists of the following three applications:

  • DemoApp: It is the Razor Pages application that acts as a gRPC client. ...