-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
auto login from saved session data #29
Conversation
increasing the waiting timeout for login because in some places with sad connection speeds may be scarce
save and read session data for login in a json file
empty lines
you have a beautiful project here, a very small contribution. |
Thanks for the contribution! Personally, I think I would prefer the library not write these things to disk and opt for whoever is using it to take care of that instead. In my eyes, there are a couple of things that may cause it to not work as intended, so I would leave it up to the user to decide what is best for what they're trying to do. |
@gabriel-tandil Looking at this again, I think we can do it. For whatever reason when I first reviewed this I assumed it was going into the library, but upon checking again I see that this is merely a contribution to the example. In this case, I think it's ok we provide something as a base for other people to build upon. Regardless, this whole example.js thing is less than ideal and I'd like to have a proper guide up at some point. If you want, you can reopen this and we can get it merged. My only comments would be to rename |
This is as suggested in #29. Mainly implemeted to ease work while developing, but also serves as an example.
I want to auto generate new session if the session details found in ./session.json is old. How is that possible? |
@iamshouvikmitra An "auth_failure" event is emitted when a session restore is not possible. You can use this to detect it and delete the existing session. |
Yeah, @pedroslopez would you mind sharing a snippet of the same implementation. I am a little confused about killing the previous session. And defining a new client. Ex -
|
This is as suggested in pedroslopez#29. Mainly implemeted to ease work while developing, but also serves as an example.
save and read session data for login in a json file