Hi, I'm trying to attach CallCredentials to an RPC. This is what I've done, 
using AccessTokenCallCredentials as an example:

class UsernamePasswordCallCredentials(grpc.AuthMetadataPlugin):

 def __init__(self, username):

       self._username = username

 def __call__(self, context, callback):

       print "in __call__"

       metadata = (('x-custom-auth-ticket', self._username),)

       callback(metadata, None)

       

call_creds = 
metadata_call_credentials(UsernamePasswordCallCredentials("foo"))

channel = grpc.insecure_channel("localhost:50055")

stub = my_pb2_grpc.myStub(channel) 
        stub.ListUser(Empty(), credentials=call_creds)

Not only does my custom header not appear to be set, but I can't find an 
evidence that UsernamePasswordCallCredentials.__call__ is ever being 
called. Where am I going wrong?

Thanks,
Scott

-- 
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/c5fd8d6d-f686-4e44-90e2-98e33fd8e75a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to