Mailing List Archive

BREAKING CHANGE: action=watch now requires token (and API requires token and POST)
Hi all,

As of MediaWiki 1.19 the action of watching or unwatching a page
requires a
token [1]. A similar measure was taken during the development of 1.17
the markpatrolled action, and the reason is the same: To prevent
third-party sites from executing write actions without the users'

The ApiWatch module must be posted and given a token. As with other
edittoken-based api actions, the token is salted but stays the same
throughout a session. Scripts may retrieve this token, as usual, through
the ApiQueryInfo (must be logged in, anon users don't have action-watch)

On a sidenote, recently the the mw.user.tokens resourceloader module [8]
has been created [9]. This, together with the mw.user.options module
introduced in 1.17, gadgets can do advanced actions without polling
the API
for common data. If you script is ran from a wiki, you can get the
from [5] this Map without an http request to the query info module. An
example has been made in the module [6].
(un)watches through the API.

The actual change in the WatchAction class was made in r89545 [3].
The ApiWatch module was changed in r88522 [7].


[1] Require token for
(un)watching pages

[2] Add token to action=watch API


[4] http://yourdomain/w/api.php?action=query&prop=info&titles=Main+Page&intoken=watch




[8] Expose user.tokens like we do
user.options in ResourceLoader


Wikitech-l mailing list