Grpc-web: Add ability to send cookies cross domain

Created on 19 Apr 2018  路  6Comments  路  Source: grpc/grpc-web

As far as I understand, there is no way to send cross domain cookies with the current grpc-web client implementation. Looking at the code, I see that grpc-web is using xhrio to send the requests to the server but I don't see any settable property nor option in the grpc client that would enable the xhrio "withCredentials" flag.

Would it be possible to add this feature? It would be really helpful for our current scenario.

Most helpful comment

This feature is in the internal version of the library. We will be glad to add it here. How do you envision using this? Should this be a call-level option? Or should it be service/stub level?

All 6 comments

This feature is in the internal version of the library. We will be glad to add it here. How do you envision using this? Should this be a call-level option? Or should it be service/stub level?

Service/stub level. It's a no-op if calls are from the same origin.

Thanks for the fast reply! Sevice/stub level works for me.

Any updates on this? We're currently blocked from going to production due to this issue.

Added an option in #604 to allow clients to enable withCredentials to true.

var client = new EchoServiceClient('localhost', null, {
  'withCredentials': true
});

But before I cut the next release including this fix, is it possible that someone can verify if this works for your use case? Coz I received a report that even with #604, cookie is not being attached to a cross-domain request. So I was wondering if we are still missing something.

I'm trying to do this with envoy but nothing seems to work like expected.
Someone have an envoy config sample to do this?
Cors allow_credentials is set server side.
withCredentials is set client side.
But Access-Control-Allow-Origin is always equal to '*' in the response headers.
So the request/response has been blocked by CORS policy.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

graup picture graup  路  4Comments

developerlaoz picture developerlaoz  路  3Comments

henpanta picture henpanta  路  5Comments

dv29 picture dv29  路  6Comments

joaomlneto picture joaomlneto  路  4Comments