grpc-web icon indicating copy to clipboard operation
grpc-web copied to clipboard

WithCredentials not work

Open iamjbw opened this issue 3 years ago • 3 comments

when I set this new TestService(url null, {withCredentials: true}), but it seems not work for me. cookie did not send with request

iamjbw avatar Feb 09 '22 03:02 iamjbw

Thanks for report :)

As far as i could tell, we're correctly passing along option as the withCredentials attribute on the XHR: https://github.com/grpc/grpc-web/blob/ce7d734e8a1a7d1f09fd6bdb23299f3ef7447887/javascript/net/grpc/web/grpcwebclientbase.js#L188

Could you provide more details on how exactly is your setup (e.g. domain names) and what are you expecting?

Thanks :)

sampajano avatar Feb 09 '22 06:02 sampajano

image image image image

version: 1.3.1

It seems withCredentials not work, cookie did not send

iamjbw avatar Feb 09 '22 09:02 iamjbw

Thanks for the additional info :)

From my local testing using the echo server, withCredentials: true will fail CORS check due to Access-Control-Allow-Credentials is not set on the test server. (Which proves that the flag is taking effect.) If i also set suppressCorsPreflight: true, then i can see the cookie being attached.

Could you provide full information on all the requests/responses that you observed?

Thanks :)

sampajano avatar Mar 28 '22 23:03 sampajano