Popup fails with dialog "Error: could not connect to main window"
happybeing opened this issue · 8 comments
I have this with both a local NSS server (5.0.1 I think) with Solid Plume deployed on my pod.
Live: https://thewebalyst.solid.community/plume/
Code: https://github.com/theWebalyst/solid-plume/ (default branch)
I can log in by visiting my pod home page, and then refreshing Plume, but not when Plume invokes the solid-auth-client popup itself.
That would happen if the main window is not running the solid-auth-client code (which sets up various listeners to the popup). So I would be inclined to say it's a Plume bug. I also noticed that Plume is using deprecated SolidAuthClient
interfaces. Might be a version mismatch.
Where exactly does Plume load solid-auth-client?
Thanks @RubenVerborgh that's probably enough for me to go on. I will dig into it.
@RubenVerborgh Plume index.html includes rdflib.js. Using an old version of rdflib.js it can then access SolidAuthClient
(fetch, popupLogin etc).
I updated rdflib.js to master and now SolidAuthClient
is not available. I do see window.solid.auth
, but it only has window.solid.auth.fetch
(none of the other methods I'd expect). I guess this is because rdflib Fetcher only imports solid.auth.fetch
.
Would it be a good idea to expose solid.auth
fully via rdflib.js so a simple website can <script src='rdflib.min.js></script>
and then use solid.auth
in full?
What I expect to happen is that rdflib
depends on window.solid.auth
. rdflib
should not include any partial or full build of solid-auth-client
. By including solid-auth-client
before rdflib
, rdflib will pick it up.
Ah, thanks I'll try that.
I note this in fetcher.js:
// This is a special fetch which does OIDC auth, catching 401 errors
const {fetch} = (typeof window === "undefined")
? require('solid-auth-cli')
: require('solid-auth-client');
Yes, but: https://github.com/linkeddata/rdflib.js/blob/v0.20.1/webpack.config.js#L45-L46,
so webpack will translate require('solid-auth-client')
into window.solid.auth
.
That fixes it, I now have a different error and can sort that (I don't yet have the popup HTML deployed!) You were super fast and super helpful again, thanks very much @RubenVerborgh