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 grpc-io+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/4344ed05-b2c3-4249-8797-edc206e19a83n%40googlegroups.com.

Reply via email to