Steps to replicate the issue (include links if applicable):
- Create a new, fresh installation of WBS (this issue still exists as of the latest commit in the wikibase-suite github repo, https://github.com/wmde/wikibase-suite).
- Start WBS.
- Verify that it is by and large functional.
- Access the Quickstatements main page.
- Attempt to log in using the link at the top-right.
What happens?:
Quickstatements will return a piece of HTML code (which the browser registers as a malformed JSON due to the response having the application/json header) describing an "Error retrieving token1", continuing with "An error occurred in the OAuth protocol: Invalid signature".
Below is the full text of the response returned by QuickStatements:
<br />
<b>Fatal error</b>: Uncaught Exception: Error retrieving token1: {&quot;error&quot;:&quot;mwoauth-oauth-exception&quot;,&quot;message&quot;:&quot;An error occurred in the OAuth protocol: Invalid signature&quot;,&quot;callback&quot;:&quot;https:\/\/wikibase.dev.labs.wikimedia.pt\/tools\/quickstatements\/api.php&quot;} in /var/www/html/magnustools/public_html/php/oauth.php:296
Stack trace:
#0 /var/www/html/quickstatements/public_html/api.php(123): MW_OAuth->doAuthorizationRedirect('https://wikibas...')
#1 {main}
thrown in <b>/var/www/html/magnustools/public_html/php/oauth.php</b> on line <b>296</b><br />Though I have verified this same day that this issue continues to exist in the latest commit of the repo above, I have not tested the effect that the new "WIKIMEDIA_OAUTH_CONSUMER_TOKEN" and "WIKIMEDIA_OAUTH_SECRET_TOKEN" may have on this issue. They are listed as optional and I have left them blank. However, I must note that this issue predates these env variables' presence in the repository: I first noticed it about two or three months ago, and as far as I can tell it's simply always been there without me or my team noticing it, due to none of us using quickstatements very often.
What should have happened instead?:
Quickstatements should have redirected the user to the associated MediaWiki instance's login page, and on logging in, the user should have been redirected back to quickstatements, with an authenticated session started.
Software version (skip for WMF-hosted wikis like Wikipedia):
The quickstatements image version used for this is wikibase/quickstatements:1.
I have also verified that this issue exists in at least three wikibase image versions: wikibase/wikibase:3, 7, and the latest, 8.
Though I doubt the issue lies there, I should mention the traefik image's version: traefik:3
Other information (browser name/version, screenshots, etc.):
In the troubleshooting section of the quickstatements image's README.md (https://github.com/wmde/wikibase-suite/blob/main/development/images/quickstatements/README.md#Troubleshooting), there is a section dedicated to OAuth errors. However, its advice doesn't seem applicable here: This issue occurs on any fresh installation of WBS, with zero input from the user barring the specification of env variables. Neither $wgSecretKey nor $wgOAuthSecretKey are subject to any changes, and the "passing of the correct consumer token and secret token to QuickStatements" it mentions is not an action handled by the user.
Below is a screenshot demonstrating the Quickstatements response as displayed by the browser (Firefox):
Finally, I should mention that, though I have been talking about this issue in the context of new, recent installs of WBS, like I said previously, it has existed for a long time. One particular installation I am involved with is related to a project named EchoImages, in which you can see this error for yourself (https://wikibase.echoimages.labs.wikimedia.pt/tools/quickstatements/). This installation is over a year old, and though I can't say for sure, I believe quickstatements has never been functional in that time.



