grpc_kit icon indicating copy to clipboard operation
grpc_kit copied to clipboard

Token-based authentication

Open gsahancsc opened this issue 3 years ago • 0 comments

Hi, trying to replace grpc with grpc_kit to call regular grpc endpoint, I can call using grpc but after changing grpc_kit it has 'EOFError (EOF):' error. I thought that remote server closed connection because of applying credentials.

I coundn't find GRPC::Core::ChannelCredentials or related in grpc_kit, could you please advice ?

old code grpc , it works ;

creds = GRPC::Core::ChannelCredentials.new(nil, nil, nil)
stub = Com::VService::Speech::V1::Speech::Stub.new(SERVER, creds)
metadata = { authorization: "Bearer TokenX" , trackingid: '123'}
stub.get_recognize(req, metadata: metadata)

new with grpc_kit ( if I don't stringify_keys it raises cannot convert symbol to string error )

sock = TCPSocket.new('host.co', 443)
stub = Com::VService::Speech::V1::Speech::Stub.new(sock)
metadata = { authorization: "Bearer TokenX", trackingid: '123'}
stub.get_recognize(req, metadata: metadata.stringify_keys)

gsahancsc avatar Dec 06 '22 11:12 gsahancsc