What is the problem?
Seen once in Production:
Message: Uncaught PHP Exception Exception: "Unable to get CSRF token from: {"error":{"code":"mwoauth-invalid-authorization","info":"The authorization headers in your request are not valid: No approved grant was found for that authorization token.","*":"See https://commons.wikimedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes."},"servedby":"mw1278"}" at /mnt/nfs/labstore-secondary-tools-project/svgtranslate/app/src/Service/MediaWikiApi.php line 117 Time: 2019-08-10 21:44:42 Channel: request Context: exception: { "class": "Exception", "message": "Unable to get CSRF token from: {\"error\":{\"code\":\"mwoauth-invalid-authorization\",\"info\":\"The authorization headers in your request are not valid: No approved grant was found for that authorization token.\",\"*\":\"See https://commons.wikimedia.org/w/api.php for API usage. Subscribe to the mediawiki-api-announce mailing list at <https://lists.wikimedia.org/mailman/listinfo/mediawiki-api-announce> for notice of API deprecations and breaking changes.\"},\"servedby\":\"mw1278\"}", "code": 0, "file": "/mnt/nfs/labstore-secondary-tools-project/svgtranslate/app/src/Service/MediaWikiApi.php:117", "trace": [ "/mnt/nfs/labstore-secondary-tools-project/svgtranslate/app/src/Service/Uploader.php:33", "/mnt/nfs/labstore-secondary-tools-project/svgtranslate/app/src/Controller/TranslateController.php:224", "/mnt/nfs/labstore-secondary-tools-project/svgtranslate/app/vendor/symfony/http-kernel/HttpKernel.php:151", "/mnt/nfs/labstore-secondary-tools-project/svgtranslate/app/vendor/symfony/http-kernel/HttpKernel.php:68", "/mnt/nfs/labstore-secondary-tools-project/svgtranslate/app/vendor/symfony/http-kernel/Kernel.php:198", "/mnt/nfs/labstore-secondary-tools-project/svgtranslate/app/public/index.php:46" ] } Extra: host: tools.wmflabs.org uri: https://tools.wmflabs.org/svgtranslate/File:Status_iucn3.1_CR.svg
I can reproduce this when I, for example, clear my cookies without refreshing SVGTranslate (so the UI thinks I am still logged in) and then try to upload a translations.
Or, click logout then click Back on the browser, then attempt to upload a translation.
From @aezell:
...We can catch the error and prompt the user to login. We probably need a decision about what to with in progress translations that might be lost.
I'd leave that prioritization and decision to @ifried
Steps to reproduce problem
- Go to https://tools.wmflabs.org/svgtranslate-test/File:2002_AJ129-orbit_(multilingual).svg (for example) and login
- Clear cookies (don't refresh page)
- Select a translation language and type some translations
- Click "Upload to Commons"
Expected behavior: Possibly see @aezell comment above.
Observed behavior: Exception above.
Note: The estimation that we've provided is for catching the error and displaying a message to the user.