Managing access to resource using inrupt/solid-client Javascript package

Hi all,
I’m trying to build a solid application using the Inrupt solid-client package and after following the tutorial found at Using the Libraries — Inrupt JavaScript Client Libraries, I have hit a roadblock.

I can create resources in my pod through the application fine, but now I need to be able to make these resources private so that only authorised users can view/update them.
The tutorial shows steps for creating/updating/deleting resources in the pod (which is working fine), but then when it comes to managing the access to these resources it seems like the steps to create an ACL for a resource are missing.

The next step in the tutorial at Manage Access to Data (WAC) — Inrupt JavaScript Client Libraries shows how to read the ACL or update the ACL for a resource, but I can’t seem to get the initial ACL creation working through the app.
Has anyone had experience with this issue or know of any other guides that I could follow to create a protected resource with the package? Any help is really appreciated!
Thanks, Dylan

Usually resources are private by default, unless you placed them in a public container (and many Pods have /public as a public container by default).

Is there a reason you skipped to the “(WAC)” page of the tutorial? There’s also a high-level API, which includes functions like setPublicAccess and setAgentAccess that allow you to set access for a particular resource.

For example, you could do:

await setPublicAccess(
  { read: false },
  { fetch: session.fetch },


await setAgentAccess(
  { read: false },
  { fetch: session.fetch },

I skipped to WAC as opposed to ACP because I thought Access Control Lists would be most suitable for my application requirements. It seemed like they are two separate ways of controlling authorization to a resource but I could be wrong there?

I tried ‘setAgentResourceAccess’ and ‘getAgentAccess’ as part of the ’ Change Access to a Resource’ heading in the ‘WAC’ page, but it just messed up the dataset somehow that I was unable to expand it in the portal.

I was also trying to get that ‘setAgentAccess’ function working earlier but I was getting a build error - the “inrupt/solid-client/access/universal” package won’t get compiled in the app for me because it’s in solid-client version 1.5 whereas the latest on npm is version 1.17. Did you need to update the version of the package to use these functions?

Yes, but unfortunately it is not up to you which to use, but to the user: their Pod can either support one or the other.

Note that the page I linked to wasn’t specific to ACP, but to documentation about a higher-level API that will automatically switch between ACP and WAC depending on what the user’s Pod supports. (Nearly seamlessly, as long as you don’t set controlRead and controlWrite to different values…)

1.17 is higher than 1.5 (because 17 > 5, yes, that’s confusing), so that should be fine. It could be that your environment doesn’t support submodule imports yet - if that’s the case, there’s also a top-level access export, which you can use as follows:

import { access } from "@inrupt/solid-client";

await access.setPublicAccess( /* ... */ );
await access.setAgentAccess( /* ... */ );

Ok perfect I will try that now. Thanks so much for your help, that really clears things up about the version numbers and authorization methods!

1 Like