gRPC interceptors

A gRPC interceptor is a function that wraps RPC execution to apply shared behavior before or after a handler runs. In this course, unary and stream interceptors implement authentication, logging, and other cross-cutting server policies in a centralized location.

Minimal example

go
grpc.NewServer(
    grpc.ChainUnaryInterceptor(
        LogUnary,
        AuthUnary,
    ),
)

Learn this concept

Lesson 7.12 · Protobuf contracts in Go

Used in exercises

Exercise 7.13 · gRPC order service Exercise 7.17 · gRPC resilience interceptors
Prerequisite conceptsgRPCgRPC metadata