Hi there! We're running into a puzzling issue that I hope somebody here can shed some light on.
We're building a tool (https://loom.everypolitician.org/ | https://github.com/opensanctions/poliloom/) that extracts statements on politicians from Wikipedia and the wider web, offers those to evaluators and on confirmation, pushes these statements to Wikidata. This makes use of the mediawiki OAuth system so people update Wikidata on their own account.
I'm running into the problem that I can't push Wikidata statements from our production environment, while the same code works fine in development. In production, we get a HTTP 403 JSON response:
{"error":"rest-write-denied","httpCode":403,"httpReason":"Forbidden"}Our OAuth2 app settings are exactly the same for production and development.
I've ran the production setup locally to make sure there's no problem there, that works. Checked what tokens went out on the API request, both local development and production send the same access tokens, with the same permissions and user information, with only the AUD related claims differing, as expected.
I've tracked this issue to logic in Wikibase that returns this 403 on UseCaseError::PERMISSION_DENIED_UNKNOWN_REASON which does not provide much insight. When I look through the Wikibase source for this UseCaseError, I see some references to "protected" pages, however when I check entities that I'm trying to create statements for, I see no indication of them being protected. For example entity Q32965:
Failed to create statement for entity Q32965 with property P39: HTTP 403 - {"error":"rest-write-denied","httpCode":403,"httpReason":"Forbidden"}
Failed to push PositionEvaluation 5e8bc92d-1856-4c04-818f-05bec5aa725a to WikidataWhat is happening here? Why are edits from my development machine accepted, but edits coming from our production server denied? The software is doing the exact same thing, the OAuth2 configuration is exactly the same. Is our production app lacking permissions? And how do I figure out if Wikidata items are protected?
Thanks in advance for any help!