SolidOS/solid-ui

Error cannot fetch your preferences when not logged in

Opened this issue · 9 comments

Unable to fetch your preferences - this was the error:  Error: (via loadPrefs) Error: Can't log in: Error: Could not log in
    at _callee5$ (authn.ts:288)
    at tryCatch (runtime.js:63)
    at Generator.invoke [as _invoke] (runtime.js:294)
    at Generator.throw (runtime.js:119)
    at asyncGeneratorStep (asyncToGenerator.js:3)
    at _throw (asyncToGenerator.js:29)

The error is raised in https://github.com/solid/solid-ui/blob/6a9e81a980072cb7f7b8e8098346bd1acac55269/src/authn/authn.ts#L219

This is caused by calling solidLogicSingelton without being logged in

Hi @bourgeoa I'm wondering what would the expected behavior be? Should we just be told that we are not logged in?

I also can't seem to recreate it. I'm wondering if you could show the steps you took to produce it. I logged in, went to preferences, logged out and it just refreshes and goes to my public data.

what would the expected behavior be? Should we just be told that we are not logged in?

@SharonStrats Profile and public preferences should be available.

I also can't seem to recreate it. I'm wondering if you could show the steps you took to produce it. I logged in, went to preferences, logged out and it just refreshes and goes to my public data.

Logging out do not clear public preferences

@bourgeoa @SharonStrats

maybe this is a good first issue to wrap my head around.
I' m trying to reproduce it. being not logged in and opening the settings container throws a 401 (see pic).

what is the desired behaviour ? being in which state and doing what exact steps shows the error ?
where would the public preferences be meant to be shown ?

Bildschirmfoto_2022-01-09_11-31-32

@ewingson
The error appears in the browser developper :
image

@bourgeoa @SharonStrats

I was able to reproduce it (see pic).
Alain, you already tracked it down fortunately.
Dunno though if the code seems to trigger (or need) a Login.

maybe we must remove (or modify) the triggering mechanism solidLogicSingelton.
Bildschirmfoto_2022-01-09_13-12-44

@bourgeoa @SharonStrats

I tried to follow the code flow.
to me the console says Line 288. ((see two pics)).
Bildschirmfoto_2022-01-09_14-07-58
Bildschirmfoto_2022-01-09_14-07-12

Since we are not logged in, it should not even try to read the preference file. The check to see if the user is logged in should happen before, in the code. @jeff-zucker am I correct to say that the app should not even look for it?

Yes, I believe that is correct, the preferencesFile is private and can only be accessed when logged in so there is no point in looking for it if not logged in. I believe the correct behavior is

  1. Load the WebID Profile Document
  2. If logged in, load the preferences file
    2a. If no preferences file found, offer to create one
  3. If not logged in, perhaps informative message in console :"not logged in, no preferences loaded"

This was also discussed in SolidOS team meeting (see under tech topics).
Same steps as Jeff mentioned a bit more implementation detail.