From 4f78f81eb0f0c50d5e50ac161a479d211329f8ab Mon Sep 17 00:00:00 2001 From: Lhaaits Date: Tue, 16 Jan 2024 11:01:39 +0100 Subject: [PATCH] Reset tokens on login error (#810) also clear csrf token and cookies. Closes #442. * Remove version changes --------- Co-authored-by: Lauren Haaitsma Co-authored-by: Antonin Delpeuch --- .../java/org/wikidata/wdtk/wikibaseapi/BasicApiConnection.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/BasicApiConnection.java b/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/BasicApiConnection.java index bfdc9c2d1..3d0b8eab2 100644 --- a/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/BasicApiConnection.java +++ b/wdtk-wikibaseapi/src/main/java/org/wikidata/wdtk/wikibaseapi/BasicApiConnection.java @@ -184,6 +184,8 @@ protected void login(String username, String password, ILogin loginFunction) thr loginFunction.login(token, username, password); } catch (NeedLoginTokenException | TokenErrorException e) { // try once more clearToken("login"); + clearToken("csrf"); + clearCookies(); token = getOrFetchToken("login"); loginFunction.login(token, username, password); }