Browser extension origin unauthorized for writing file

Hello everyone,

I have been building a chrome extension that is supposed to perform read and write operations on a Solid pod. I managed to authenticate users and also read files from the private folder which requires the user to be logged in. However, when I’m trying to write a file, I always get Error 403 - Origin unauthorized. Furthermore, when using the solid-file-client I also get the response that the user is logged in but doesn’t have permission to access the file. Reading and writing to the private folder should both require the user to be logged in so I’m unsure why writing is not working. One obvious problem could be that the browser extension is not listed under the trusted applications in my profile, however, I’m not sure how this could be solved with a browser extension as it doesn’t have a URL. Also if that would be problem, I don’t understand why reading from a private folder works, although the extension is not listed under trusted applications. I would appreciate if anyone has any ideas about solving this problem.

I tried writing with solid.auth.fetch, getFile from solid-client and with the SolidFileClient from Jeff Zucker.

1 Like

Sounds like your extension does have an origin that the browser is sending, so the first step in debugging I would take is console.log(document.location.origin) from your extension and see what that is. With a bit of luck, that URL is stable and you can add it to your trusted apps. IIRC on Firefox the URL’s something like moz-extension:... and on Chromium-based browsers something like chrome-extension:.., but I’m not sure if that latter part is stable.

2 Likes

Thank you very much, that worked for me. So far, it seems like the URL is stable. I’m wondering why the popup to add the browser extension to trusted applications doesn’t automatically come up but I think that will probably be possible to solve easily. Reading and writing works perfectly now :+1: