Martin Dørum
unread,Sep 12, 2022, 6:54:04 AM9/12/22Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to grpc.io
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?