Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle multiple logins #117

Open
Otto-AA opened this issue Apr 15, 2019 · 5 comments
Open

Handle multiple logins #117

Otto-AA opened this issue Apr 15, 2019 · 5 comments

Comments

@Otto-AA
Copy link
Contributor

Otto-AA commented Apr 15, 2019

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?

@RubenVerborgh
Copy link
Contributor

Is there a way to handle multiple logins simultaneously?

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

@Otto-AA
Copy link
Contributor Author

Otto-AA commented Apr 15, 2019

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 :)

@RubenVerborgh
Copy link
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.

@Otto-AA
Copy link
Contributor Author

Otto-AA commented Apr 15, 2019

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 :)

@RubenVerborgh
Copy link
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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants