# Example about supplying fetch with solid-client-authn-node library

**URL:** <https://forum.solidproject.org/t/example-about-supplying-fetch-with-solid-client-authn-node-library/5419>\
**Category:** General Discussion\
**Created:** [June 28, 2022, 7:56pm UTC](https://forum.solidproject.org/t/example-about-supplying-fetch-with-solid-client-authn-node-library/5419 "2022-06-28T19:56:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![gaz009](https://avatars.discourse-cdn.com/v4/letter/g/a5b964/32.png) [@gaz009](https://forum.solidproject.org/u/gaz009)\
**Post date:** [June 28, 2022, 7:56pm UTC](https://forum.solidproject.org/t/example-about-supplying-fetch-with-solid-client-authn-node-library/5419/1 "2022-06-28T19:56:19Z")

</div>

Hello all,

I am working on building a simple web server app with Node and Solid. However, I am having trouble understanding how to use session.fetch() with the solid client methods. I can use it as canonical fetch to perform requests, however I want to use it in methods like saveSolidDatasetAt etc etc and I am not sure how to supply it as an option correctly. Could anyone point me to some example code or something small they wrote themselves?

Thanks in advance

---

<div class="post-metadata">

**Author:** ![A\_A](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/a_a/32/786_2.png) [@A\_A](https://forum.solidproject.org/u/A_A)\
**Post date:** [June 29, 2022, 5:22am UTC](https://forum.solidproject.org/t/example-about-supplying-fetch-with-solid-client-authn-node-library/5419/2 "2022-06-29T05:22:50Z")

</div>

I haven’t worked with node, but I guess this should work:

```javascript
  const myDataset = await getSolidDataset(
    "https://example.org/", 
    { fetch: session.fetch.bind(session) }
  );

```

---

<div class="post-metadata">

**Author:** ![A\_A](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/a_a/32/786_2.png) [@A\_A](https://forum.solidproject.org/u/A_A)\
**Post date:** [June 29, 2022, 5:30am UTC](https://forum.solidproject.org/t/example-about-supplying-fetch-with-solid-client-authn-node-library/5419/3 "2022-06-29T05:30:46Z")

</div>

And [here](https://grep.app/search?q=fetch%3A%20session.fetch&case=true) I’ve found this test file, which uses it multiple times: [solid-client-js/wac.test.ts at main · inrupt/solid-client-js · GitHub](https://github.com/inrupt/solid-client-js/blob/main/e2e/node/wac.test.ts)

---

<div class="post-metadata">

**Author:** ![gaz009](https://avatars.discourse-cdn.com/v4/letter/g/a5b964/32.png) [@gaz009](https://forum.solidproject.org/u/gaz009)\
**Post date:** [June 29, 2022, 4:34pm UTC](https://forum.solidproject.org/t/example-about-supplying-fetch-with-solid-client-authn-node-library/5419/4 "2022-06-29T16:34:42Z")

</div>

Thanks for the help! I forgot to pass it as a function reference and was instead passing it as a function call.

---

<div class="post-metadata">

**Author:** ![ThisIsMissEm](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/thisismissem/32/3166_2.png) [@ThisIsMissEm](https://forum.solidproject.org/u/ThisIsMissEm)\
**Post date:** [June 30, 2022, 1:56pm UTC](https://forum.solidproject.org/t/example-about-supplying-fetch-with-solid-client-authn-node-library/5419/5 "2022-06-30T13:56:39Z")

</div>

Just to clarify, you just need to do:

```auto
const myDataset = await getSolidDataset(
    "https://example.org/", 
    { fetch: session.fetch }
  );

```

The `.bind(session)` isn’t really needed, as we’ve specifically coded the method to not be bothered by it’s `this` object (it’s already bound to the session class instance)
