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

auto login from saved session data #29

Closed
wants to merge 3 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
auto login enhaced
increasing the waiting timeout for login because in some places with sad
connection speeds may be scarce
  • Loading branch information
gabriel-tandil committed Dec 24, 2019
commit a3508da3d47ac6585a723d3aedda0abb591cc932
4 changes: 3 additions & 1 deletion src/Client.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class Client extends EventEmitter {
localStorage.setItem("WAToken1", session.WAToken1);
localStorage.setItem("WAToken2", session.WAToken2);
}, this.options.session);


}

await page.goto(WhatsWebURL);
Expand All @@ -51,7 +53,7 @@ class Client extends EventEmitter {
if (this.options.session) {
// Check if session restore was successfull
try {
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 5000 });
await page.waitForSelector(KEEP_PHONE_CONNECTED_IMG_SELECTOR, { timeout: 50000 });
} catch (err) {
if (err.name === 'TimeoutError') {
this.emit(Events.AUTHENTICATION_FAILURE, 'Unable to log in. Are the session details valid?');
Expand Down