I do not think we support that. Actually I think tokens are intentionally
dropped if the channel is not secure to avoid leaking the tokens over the
wire.

On Wed, Feb 7, 2018 at 3:04 PM, <[email protected]> wrote:

> I was able to get this working by simply calling AddMetadata on the client
> context to set the authorization header. This appears to work for both
> secure and insecure connections, so I'll go with this approach rather than
> using the custom authenticator.
>
> On Wednesday, 7 February 2018 12:20:11 UTC-8, [email protected] wrote:
>>
>> 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 have created a custom authenticator plugin following the sample code at
>> https://grpc.io/docs/guides/auth.html.
>>
>> I build my custom call credentials and store them using a
>> CompositeChannelCredientials object
>>
>> auto call_creds = grpc::MetadataCredentialsFromP
>> lugin(std::unique_ptr<grpc::MetadataCredentialsPlugin>(new
>> MyCustomAuthenticator(accessToken)));
>>
>> if (secure)
>>     mCredentials = grpc::CompositeChannelCredenti
>> als(grpc::SslCredentials(opts), call_creds);
>> else
>>     mCredentials = grpc::CompositeChannelCredenti
>> als(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?
>>
> --
> 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 post to this group, send email to [email protected].
> Visit this group at https://groups.google.com/group/grpc-io.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/grpc-io/ef391109-95d8-4a1b-af5f-b0d5b46e4207%40googlegroups.com
> <https://groups.google.com/d/msgid/grpc-io/ef391109-95d8-4a1b-af5f-b0d5b46e4207%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/grpc-io.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/grpc-io/CAB1HKY5SkB3yS4oCb0u_HTfckZatsGX9%3DsfFMGrqsgceC2i-3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to