From d08b34381519c5668f9362cae16742dad449e8cf Mon Sep 17 00:00:00 2001 From: Steven L <767250+stevefold@users.noreply.github.com> Date: Mon, 23 Mar 2020 10:52:46 +1100 Subject: [PATCH] Added "restartOnAuthFail" as an option (#112) - When true, the sessions passed is discarded when reinitialized. --- src/Client.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Client.js b/src/Client.js index abfa664c1..ac2c8ac20 100644 --- a/src/Client.js +++ b/src/Client.js @@ -75,7 +75,11 @@ class Client extends EventEmitter { */ this.emit(Events.AUTHENTICATION_FAILURE, 'Unable to log in. Are the session details valid?'); browser.close(); - + if (this.options.restartOnAuthFail) { + // session restore failed so try again but without session to force new authentication + this.options.session = null; + this.initialize(this.options); + } return; }