These are called CallCredentials in C++. See: https://github.com/grpc/grpc/blob/master/include/grpcpp/security/credentials.h#L128-L153
And this might be what you are looking for, to attach JWT to every request: https://github.com/grpc/grpc/blob/master/src/cpp/client/secure_credentials.cc#L332 On Monday, September 12, 2022 at 3:54:04 AM UTC-7 Martin Dørum wrote: > > > We have some Go code which uses JWT as per RPC credentials with gRPC. I'm > trying to implement a client in C++, but I can't figure out what the > equivalent of the grpc.WithPerRPCCredentials dial option is in C++. The Go > code is like this: > > type claims struct { > claims map[string]string > secure bool > } > > func (c claims) GetRequestMetadata(ctx context.Context, a ...string) > (map[string]string, error) { > return c.claims, nil > } > > func (c claims) RequireTransportSecurity() bool { > return c.secure > } > > fn connect() { > clms := claims{ > claims: make(map[string]string), > secure: !c.insecure, > } > clms.claims["token"] = ourJWT; > conn, err := grpc.DialContext(context.Background(), addr, > grpc.WithPerRPCCredentials(clms)) > } > > What's the equivalent way in C++ to create credentials which attaches a > JWT to each request? > -- You received this message because you are subscribed to the Google Groups "grpc.io" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/grpc-io/8397da9a-b2d7-49f1-beca-593bf4d365bfn%40googlegroups.com.
