question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Expose "fetchInit" in RpcOptions to allow sending credentials

See original GitHub issue

I’m using https://github.com/timostamm/protobuf-ts/blob/master/MANUAL.md#grpc-web-transport but I don’t know if there is a way to send credentials like in a classic web client:

initClient({
  baseUrl: "localhost:3000",
  fetchOptions: { credentials: "include" },
});

Is it possible or am I totally wrong?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:11 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
timostammcommented, Apr 7, 2021

A valid point…

Yes, this should work like improbable-eng.

The following property should be added to twirp-options.ts and grpc-web-options.ts:

    /**
     * Pass options to fetch API calls. 
     */
    fetchInit?: Exclude<RequestInit, "body" | "headers" | "method" | "signal">;

And passed to all fetch calls.

I’m a bit swamped right now. Do you want to open a PR?

0reactions
frederikhorscommented, Apr 7, 2021

@timostamm Yeah, I’m hacking around like this… Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Using the Fetch API - MDN Web Docs
If you only want to send credentials if the request URL is on the same origin as the calling script, add credentials: 'same-origin'...
Read more >
How to send data using fetch and POST request with ...
@JonasWilms When I do OPTIONS request with Postman, I get Access-Control-Allow-Origin -> * so it's not good if I want credentials? I add...
Read more >
Fetch: Cross-Origin Requests - The Modern JavaScript Tutorial
Now fetch sends cookies originating from another.com with request to that site. If the server agrees to accept the request with credentials, it ......
Read more >
Fetch Standard
A response has an associated CORS-exposed header-name list (a list ... If credentials is false, then do not send a TLS client certificate....
Read more >
Fetch, CORS, and Cookies - YouTube
This tutorial explains the process of setting cookies in the browser as well as from the server. It shows the process of setting...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found