MediaWiki 1.37/Deprecation of legacy API token parameters
On October 7, 2021, the deprecated parameters that were used to obtain tokens in MediaWiki API were removed. If your script/tool/bot or gadget is using these deprecated parameters on Wikimedia Foundation wikis, it broke unless you migrate it before October 7, 2021.
Before MediaWiki 1.24 (2014, change 153110), API tokens were obtained by using various different "token" parameters in different Action APIs. In November 2014, these were deprecated, in favour of a central CSRF token query. The API responses for the deprecated features has included deprecation warnings for the past six years.
Affected features
[edit]Deprecated query | Replacement query |
---|---|
action=query&prop=info&intoken=...
|
action=query&meta=tokens&type=...
|
action=tokens&type=...
|
action=query&meta=tokens&type=...
|
action=query&list=recentchanges&rctoken
|
action=query&meta=tokens&type=patrol
|
action=query&prop=revisions&rvtoken=rollback
|
action=query&meta=tokens&type=rollback
|
action=query&meta=userinfo&uiprop=preferencestoken
|
action=query&meta=tokens&type=csrf
|
action=query&list=users&ustoken=userrights
|
action=query&meta=tokens&type=userrights
|
Deprecated type | Replacement type |
---|---|
edit
|
csrf
|
delete
|
csrf
|
protect
|
csrf
|
move
|
csrf
|
block
|
csrf
|
unblock
|
csrf
|
email
|
csrf
|
import
|
csrf
|
options
|
csrf
|
Example deprecation warning:
{
"warnings": {
"info": {
"*": "The parameter \"intoken\" has been deprecated."
}
},
"query": {
// ..
}
}
Subscribe to the mediawiki-api-announce mailing list for notice of API deprecations and breaking changes. Use Special:ApiFeatureUsage to see usage of deprecated features by your application.
What to use instead
[edit]Since 2014, action=query&meta=tokens
is the central way to obtain CSRF tokens from the API.
For example, to obtain a watch token and a patrol token, use:
api.php?action=query&meta=tokens&type=watch|patrol
For more examples and help, check out the API:Tokens manual on mediawiki.org.
Pywikibot
[edit]If you are using Pywikibot, you will need to upgrade to at least version 6.6.1, which contains a fix to no longer use these deprecated parameters.
See also
[edit]- Wikitech-l announcement, June 2021
- Tech News announcements: 19 July, 30 August, and 20 September
- T280806: Remove old action api token parameters
- Logstash: deprecated-feature-usage (NDA restricted)
- Logstash: deprecated-feature-usage-top (NDA restricted)