# Local First / Offline and Solid Login

**URL:** <https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896>\
**Category:** General Discussion\
**Created:** [November 23, 2021, 7:56am UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896 "2021-11-23T07:56:54Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Smag0](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/smag0/32/310_2.png) [@Smag0](https://forum.solidproject.org/u/Smag0)\
**Post date:** [November 23, 2021, 7:56am UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/1 "2021-11-23T07:56:54Z")

</div>

I’m working on a localFirst /offline App with backend on Solid

[https://scenaristeur.github.io/verse/](https://scenaristeur.github.io/verse/)

code [GitHub - scenaristeur/verse](https://github.com/scenaristeur/verse)

with jsonld in indexeddb [verse/idb-nodes.js at main · scenaristeur/verse · GitHub](https://github.com/scenaristeur/verse/blob/main/src/api/idb-nodes.js)

but i’ve got a question about the Solid login :

if the app go offline, should’nt be the user logged out automatically ?  
Shouldn’t @inrupt auth library detect when the app is offline without the need of refreshing the page ? and say “the user is not connected to the POD” ?

---

<div class="post-metadata">

**Author:** ![jeffz](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/jeffz/32/600_2.png) [@jeffz](https://forum.solidproject.org/u/jeffz)\
**Post date:** [November 23, 2021, 3:24pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/2 "2021-11-23T15:24:43Z")

</div>

There are serious problems with the Inrupt library logout. It does not log you out from the IDP, only from the app. See [Login button visible with private resource using nss #78 · Issue #78 · solid/solidos · GitHub](https://github.com/solid/solidos/issues/78).

---

<div class="post-metadata">

**Author:** ![Vincent](https://avatars.discourse-cdn.com/v4/letter/v/e9bcb4/32.png) [@Vincent](https://forum.solidproject.org/u/Vincent)\
**Post date:** [November 23, 2021, 3:38pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/3 "2021-11-23T15:38:44Z")

</div>

Offline detection is notoriously difficult (as in, there’s [a native in-browser API](https://developer.mozilla.org/en-US/docs/Web/API/Navigator/onLine) that does it, but it’s pretty unreliable by necessity). The auth library only indicates whether you have credentials that should be valid when you try to communicate with a Pod, not whether there’s an actual live connection.

As for not logging out from the IDP: IMO that’s expected behaviour. For example, if you use “Sign in with Google” or “Sign in with GitHub” to log in to this forum, you wouldn’t want to be signed out of Google or GitHub after you signed out from this forum either.

---

<div class="post-metadata">

**Author:** ![jeffz](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/jeffz/32/600_2.png) [@jeffz](https://forum.solidproject.org/u/jeffz)\
**Post date:** [November 23, 2021, 4:14pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/4 "2021-11-23T16:14:24Z")

</div>

> As for not logging out from the IDP: IMO that’s expected behaviour.

Perhaps it is acceptable behavior if there is a way to log out. I can got to google and logout. Also google has methods to have more than one account so I can either logout of account1 and then login to account2 or stay logged in to both. None of those things are possible with the Inrupt authn., I can not open WebId-A, logout and open WebId-B (from the same IDP) and I will never be able to until there is an auth library that impacts the IDP login.

---

<div class="post-metadata">

**Author:** ![Vincent](https://avatars.discourse-cdn.com/v4/letter/v/e9bcb4/32.png) [@Vincent](https://forum.solidproject.org/u/Vincent)\
**Post date:** [November 23, 2021, 4:59pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/5 "2021-11-23T16:59:21Z")

</div>

> [@jeffz](#):
>
> I can got to google and logout. Also google has methods to have more than one account so I can either logout of account1 and then login to account2 or stay logged in to both.

That’s up to your identity provider to provide! While you can go to Google to log out, what you can’t do is log out of your Google account from this forum’s interface. Likewise, an arbitrary Solid app can’t log you out of your identity provider, but if you go to your identity provider, it could allow you to sign out and/or manage multiple accounts. The auth library can’t force that to happen though; that has to be done by the identity provider itself.

---

<div class="post-metadata">

**Author:** ![jeffz](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/jeffz/32/600_2.png) [@jeffz](https://forum.solidproject.org/u/jeffz)\
**Post date:** [November 23, 2021, 8:00pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/6 "2021-11-23T20:00:30Z")

</div>

> That’s up to your identity provider to provide!

Yes, and no. AFAIK (which isn’t very far) there are specs defining a /.well-known/logout endpoint. I am not sure which if any IdPs provide it. I am fairly sure Inrupt’s auth client doesn’t provide any method to communicate with such endpoints if they exist.

---

<div class="post-metadata">

**Author:** ![Smag0](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/smag0/32/310_2.png) [@Smag0](https://forum.solidproject.org/u/Smag0)\
**Post date:** [November 24, 2021, 3:25pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/7 "2021-11-24T15:25:17Z")

</div>

I think that the problem that @jeffz say and that I’ve faced too is that the user is not really logout, and the prompt for choosing another webid should be accessible after logout.  
I f I logout I should be able to choose another webid to login. The matter is that the old webid is still somewhere and we can’t switch to another. Should I clean something in localstorage to be able to use another webid ?

[![](https://europe1.discourse-cdn.com/flex017/uploads/solidproject/original/2X/8/8438c72283332573111b92ad5cb9183b131d172c.jpeg "24 novembre 2021") ](https://www.youtube.com/watch?v=C9Vw-r_c_mw)

---

<div class="post-metadata">

**Author:** ![jeffz](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/jeffz/32/600_2.png) [@jeffz](https://forum.solidproject.org/u/jeffz)\
**Post date:** [November 24, 2021, 3:29pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/8 "2021-11-24T15:29:13Z")

</div>

@Smag0 - no, cleaning localStorage or cookies is not the issue. The issue is that there is a record of your login at the IdP and that is what remains after logout, not the local stuff.

---

<div class="post-metadata">

**Author:** ![Smag0](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/smag0/32/310_2.png) [@Smag0](https://forum.solidproject.org/u/Smag0)\
**Post date:** [November 24, 2021, 4:34pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/9 "2021-11-24T16:34:14Z")

</div>

You are not ok with the solution but I think you are for the matter.

I think this is a security issue.  
If I logout, this is not normal that the session is restored. Let’s say that I left the room and the computer is used by another person. That person can accès my data with no ask for webid.

---

<div class="post-metadata">

**Author:** ![jeffz](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/jeffz/32/600_2.png) [@jeffz](https://forum.solidproject.org/u/jeffz)\
**Post date:** [November 24, 2021, 4:44pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/10 "2021-11-24T16:44:43Z")

</div>

I agree with you, it is a security problem. It also causes very confusing situations for SolidOS where you are logged out of some things but not others. I’m not sure what you mean by “You are not ok with the solution but I think you are for the matter.”

---

<div class="post-metadata">

**Author:** ![Smag0](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/smag0/32/310_2.png) [@Smag0](https://forum.solidproject.org/u/Smag0)\
**Post date:** [November 24, 2021, 4:54pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/11 "2021-11-24T16:54:20Z")

</div>

My dumb solution : cleaning localstorage  
Our matter: user are not properly logged out  
😉

---

<div class="post-metadata">

**Author:** ![jeffz](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/jeffz/32/600_2.png) [@jeffz](https://forum.solidproject.org/u/jeffz)\
**Post date:** [November 24, 2021, 4:55pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/12 "2021-11-24T16:55:16Z")

</div>

Ah, got it. Yes. And not so dumb, it was the first thing I tired too :-),

---

<div class="post-metadata">

**Author:** ![NoelDeMartin](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/noeldemartin/32/3144_2.png) [@NoelDeMartin](https://forum.solidproject.org/u/NoelDeMartin)\
**Post date:** [November 25, 2021, 6:29am UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/13 "2021-11-25T06:29:02Z")

</div>

I talked about a similar topic a while ago, you may find this useful: [https://forum.solidproject.org/t/authenticating-offline-first-solid-apps](https://forum.solidproject.org/t/authenticating-offline-first-solid-apps)

As others mentioned, it’s not easy to know if a user is online or not. I like how Jake Archibald explains it in this presentation when he refers to this as [Lie-fi](https://youtu.be/cmGr0RszHc8?t=1474).

But I think the issue with being offline is not about logging out, is it? If you’re offline, I see no reason why the authentication library wouldn’t be able to log out. After all, the library doesn’t store the token anywhere and requests it again after every refresh. So any data that the library _is_ storing should be removable without an internet connection. This would be a different story if upon logging out you wanted to log out from the identity provider as well, but with the current implementation [that’s not possible](https://github.com/inrupt/solid-client-authn-js/issues/919) anyways (as Jeff mentioned).

---

<div class="post-metadata">

**Author:** ![Smag0](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/smag0/32/310_2.png) [@Smag0](https://forum.solidproject.org/u/Smag0)\
**Post date:** [November 26, 2021, 1:38pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/14 "2021-11-26T13:38:45Z")

</div>

@jeffz to logout my app , i have to got to [solidcommunity.net](http://solidcommunity.net), then login and logout. And then i can login with another webid .  
@Vincent is this the behaviour that you that is expected as i’ve understand ?

[![](https://europe1.discourse-cdn.com/flex017/uploads/solidproject/original/2X/d/de01eeef5dc3adc3be2b892b79129d015487eb4e.jpeg "Solid deconnexion") ](https://www.youtube.com/watch?v=SA3OnQWpjWc)

---

<div class="post-metadata">

**Author:** ![Vincent](https://avatars.discourse-cdn.com/v4/letter/v/e9bcb4/32.png) [@Vincent](https://forum.solidproject.org/u/Vincent)\
**Post date:** [November 26, 2021, 1:51pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/15 "2021-11-26T13:51:07Z")

</div>

> If you’re offline, I see no reason why the authentication library wouldn’t be able to log out. After all, the library doesn’t store the token anywhere and requests it again after every refresh. So any data that the library _is_ storing should be removable without an internet connection.

It could, but I don’t think you’d want to be disconnected from your Pod if your train drives through a tunnel 🙂

> [@Smag0](#):
>
> @Vincent is this the behaviour that you that is expected as i’ve understand ?

Sort of, although [solidcommunity.net](http://solidcommunity.net) could make that process easier by also allowing you to switch accounts as you connect your app to it.

---

<div class="post-metadata">

**Author:** ![Smag0](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/smag0/32/310_2.png) [@Smag0](https://forum.solidproject.org/u/Smag0)\
**Post date:** [November 26, 2021, 2:10pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/16 "2021-11-26T14:10:23Z")

</div>

> [@Vincent](#):
>
> also allowing you to switch accounts as you connect your app to it.

no because the login window does not appear after a logout from my app. when i come back and choose the same provider, the user is automagically logged in and i can’t choose another one.  
Only a logout on [solidcommunity.net](http://solidcommunity.net) can really logout and show the windo to choose the new webid.

---

<div class="post-metadata">

**Author:** ![Vincent](https://avatars.discourse-cdn.com/v4/letter/v/e9bcb4/32.png) [@Vincent](https://forum.solidproject.org/u/Vincent)\
**Post date:** [November 26, 2021, 2:26pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/17 "2021-11-26T14:26:56Z")

</div>

> [@Smag0](#):
>
> when i come back and choose the same provider, the user is automagically logged in and i can’t choose another one.

Yes, that’s the current behaviour. What I’m saying is that [solidcommunity.net](http://solidcommunity.net) _could_ show you an account picker there.

---

<div class="post-metadata">

**Author:** ![Smag0](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/smag0/32/310_2.png) [@Smag0](https://forum.solidproject.org/u/Smag0)\
**Post date:** [November 26, 2021, 2:29pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/18 "2021-11-26T14:29:56Z")

</div>

i would like to switch user without going to solidcommunity but only from my app… is it possible ?  
or that if someone use the device after me , my user is not automatically connected if i have choose to logout

---

<div class="post-metadata">

**Author:** ![Vincent](https://avatars.discourse-cdn.com/v4/letter/v/e9bcb4/32.png) [@Vincent](https://forum.solidproject.org/u/Vincent)\
**Post date:** [November 26, 2021, 2:51pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/19 "2021-11-26T14:51:30Z")

</div>

No, only if your user’s Solid Identity Provider supports that (by just sending them back to it). Which in the case of [solidcommunity.net](http://solidcommunity.net) is not the case.

---

<div class="post-metadata">

**Author:** ![Smag0](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.solidproject.org/smag0/32/310_2.png) [@Smag0](https://forum.solidproject.org/u/Smag0)\
**Post date:** [November 26, 2021, 3:13pm UTC](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896/20 "2021-11-26T15:13:38Z")

</div>

ok, so this is a solidcommunity issue . Thxs

[Next page](https://forum.solidproject.org/t/local-first-offline-and-solid-login/4896.md?page=2)
