diegodlh / zotero-cita

Cita: a Wikidata addon for Zotero with citations metadata support
GNU General Public License v3.0
233 stars 12 forks source link

Logged-in Wikidata edits fail #291

Open diegodlh opened 2 months ago

diegodlh commented 2 months ago

Describe the bug Syncing local citations to Wikidata fail if username and password are used.

To Reproduce

  1. Create Zotero item for Wikidata Sandbox 1, with QID Q4115189
  2. Locally, add citation to Wikidata Sandbox 2, with QID Q13406268
  3. Sync citations with Wikidata using your Wikidata account username and password

Expected behavior The corresponding "cites work" statement should be created in Wikidata. Instead, a "Some changes could not be uploaded" error is shown.

Screenshots image

Environment:

Additional context Note that edits do succeed if done anonymously (i.e., no username and password given).

The error seems to originate in wikibase-edit's login.js, here. res.headers.get('set-cookie') returns null.

My guess is that this may be related to wikibase-edit no longer using cross-fetch since v7. See https://github.com/maxlath/wikibase-edit/commit/5959717ddbd55ee4efafc483167e9399ad3e93b7

We used to have a cross-fetch patch that addressed the fact that parsing set-cookies headers was failing. This was reported to wikibase-edit here: https://github.com/maxlath/wikibase-edit/issues/62

diegodlh commented 2 months ago

Note that Zotero's debug console is showing multiple Some cookies are misusing the recommended “SameSite“ attribute warnings apparently linked to our requests to Wikidata's API.

Because these are just warnings, I don't think they are related to this bug. However, it may be worth it reporting them to wikibase-edit if they persist after we have solved this issue, as it may become a problem in the future, as mentioned in the warning.