Beginner Question - Storing Private Data in Solid

I’m having trouble wrapping my head around “arbitrary” data storage in Solid. The docs don’t make it very clear how to write non-VCARD data. Clearly I’m missing something.

Here’s my real problem: I’m writing an app that uses a WebID profile to serve as a bridge to a traditional server-based app. I’d like to store an API key in a WebID profile and fetch it at login time. Naturally this API key needs to be stored privately.

Can someone provide me a brief explanation about how to store arbitrary (non-VCARD) data in a POD? Perhaps some example code?

Thanks

1 Like

In essence (afaik) you need to login the user and then make http requests with those credentials.

I suggest you to use one of these libraries for doing this:
solid-file-client - Makes it easy to create/get files and folders
solid-auth-client - The underlying library which handles login and adding the credentials to the request (here is how I used it in my project. It’s also not that hard)

With those you can store arbitrary data in a POD. Something I forgot in the beginning was, that the webid location isn’t necessarily the same as the storage location so maybe ask the user where he wants it to be stored instead of guessing based on the webid’s location.

2 Likes

I think you can just store your APIKey to xxx.xxx/private/APIKeys/xxx.txt

Thanks guys. I had gotten to solid-auth-client but somehow missed solid-file-client. This should be enough to get me going!