The service refuses the request. Authentication fails. You check the logs. gRPC calls never hit your backend. The error trace points to Keycloak.
Keycloak gRPC integration is not automatic. gRPC relies on HTTP/2, binary framing, and strict metadata handling. Keycloak speaks OAuth 2.0 and OpenID Connect over HTTP. Bridging them requires design choices: token transport, validation, and scope enforcement.
To secure gRPC with Keycloak, first decide how clients will obtain and send tokens. Most teams use JWT access tokens issued by Keycloak. Clients authenticate against Keycloak’s token endpoint, receive a signed JWT, then attach it to every gRPC request. Metadata keys in gRPC are case-insensitive, but for interoperability, use authorization with the value Bearer <token>.
On the server side, interceptors validate tokens before passing calls to business logic. The interceptor loads Keycloak’s public keys via its JWKS endpoint, checks the signature, validates expiration and audience, and applies role or scope checks. In high-throughput systems, cache the keys and decoded claims. Revalidation should happen only when Keycloak rotates keys or when token expiration requires it.