Skip to content

Handle multiple logins #117

Open
Open

Description

@Otto-AA

Is there a way to handle multiple logins simultaneously?

In my filemanager (this one) this could be used to transfer files between two private pods without the need to download them. For other applications this could be helpful for easily switching between different accounts, or accumulating data from two or more.

And if not, do you know if it would be possible to tweak (a fork of) this package to do this, or if it isn't possible because of server side restrictions?

Activity

  1. RubenVerborgh commented on Apr 15, 2019

    @RubenVerborgh
    Contributor

    Is there a way to handle multiple logins simultaneously?

    Not yet. There are indeed some use cases where this would be useful.

  2. Otto-AA commented on Apr 15, 2019

    @Otto-AA
    ContributorAuthor

    Ok, thanks for your fast response. Do you mean that it is not possible or just not implemented yet?

    If it is latter, I could take a look at it in the next days and try to implement it :)

  3. RubenVerborgh commented on Apr 15, 2019

    @RubenVerborgh
    Contributor

    It's possible, but not implemented yet.

    I'd be very happy if you could take a look at it, but I'm pretty sure it will take a substantial effort, given that the interface the library would have to change. I would consider this a major rewrite.

  4. Otto-AA commented on Apr 15, 2019

    @Otto-AA
    ContributorAuthor

    I think the interface itself doesn't need to change much, "only" the underlying code would need to be refactored. I would have thought of wrapping the functionality into a class, which then can be created multiple times. And to keep backwards compatibility a default instance could be created.

    So from the users point of view I would propose something like this:

    const auth = require('solid-auth-client');
    
    const defaultSession = auth;
    const myFirstSession = auth.createNewSession();
    const mySecondSession = auth.createNewSession();
    
    await defaultSession.login(idp);
    await myFirstSession.login(idp);
    await mySecondSession.login(ipd);
    
    await defaultSession.fetch(url, options);
    await myFirstSession.fetch(url, options);
    // And so on...

    I will take a look at it in the next few days and notify you if I manage to get it working or not. I won't start until tomorrow, so if you have any suggestions or tips it would be nice if you could make them in this time span :)

  5. RubenVerborgh commented on Apr 15, 2019

    @RubenVerborgh
    Contributor

    I think the interface itself doesn't need to change much

    But…

    const myFirstSession = auth.createNewSession();

    …that is a substantial interface change 😉

    The good thing is that part of the refactoring you need for this already exists, in that solid-auth-client exposes a default instance of a class. So createNewSession would be creating more instances.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions