Skip to content

MediaWiki's login action is deprecated #26

Description

@jimsafley

See https://www.mediawiki.org/wiki/API:Login

Since MediaWiki 1.27.0 the login action has been deprecated in favor of the new clientlogin action. We've already seen an inconsistency in the API result (see #25) but we need to prepare for login's eventual removal.

In Scripto_Service_MediaWiki::login() we'll need to replace the existing login requests with the clientlogin interactive flow:

$params = array('meta' => 'tokens', 'type' => 'login');
$response = $this->_request('query', $params);
$logintoken = $response['query']['tokens']['logintoken'];

$params = array(
    'username' => $username,
    'password' => $password,
    'logintoken' => $logintoken,
    'loginreturnurl' => 'http://example.com',
    'rememberMe' => '1',
);
$response = $this->_request('clientlogin', $params);

On top of this we'll need a way to determine when to use the login action for older installations.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions