I'm looking into how to support client connections to disparate services using custom oAuth2 tokens. The services may or may not support SSL/TLS.
I build my custom call credentials and store them using a CompositeChannelCredientials object
auto call_creds = grpc::MetadataCredentialsFromPlugin(std::unique_ptr<grpc::MetadataCredentialsPlugin>(new MyCustomAuthenticator(accessToken)));
if (secure)
mCredentials = grpc::CompositeChannelCredentials(grpc::SslCredentials(opts), call_creds);
else
mCredentials = grpc::CompositeChannelCredentials(grpc::InsecureChannelCredentials(), call_creds);
However, I noticed during debugging that mCredentials is nullptr when connecting to a service that doesn't support SSL/TLS. It looks like CompositeChannelCredentials attempts to cast the InsecureChannelCredentials to SecureChannelCredentials, with this cast returning NULL.
Is there any documentation or sample code of how to make an authenticated call over an insecure channel? Is this something that's currently supported in the C++ API?