Page MenuHomePhabricator

[mediawiki-api-base] Add OAuth support
Closed, InvalidPublic

Description

https://lists.wikimedia.org/pipermail/mediawiki-api-announce/2016-January/000100.html

OAuth support should be added:

If possible, switch to OAuth. This week (1.27.0-wmf.10) "owner-only"

consumers are being rolled out to make this easier for bot operators: log
into your bot account

Related Objects

StatusSubtypeAssignedTask
DeclinedNone
InvalidNone

Event Timeline

Addshore raised the priority of this task from to Needs Triage.
Addshore updated the task description. (Show Details)
Addshore added a project: Addwiki.
Addshore subscribed.
Addshore renamed this task from [Addwiki] [mediawiki-api-base] Adapt for "Upcoming BREAKING CHANGE: Changes to login for bots" to [Addwiki] [mediawiki-api-base] Add OAuth support.Jan 15 2016, 3:36 PM
Addshore triaged this task as High priority.
Addshore lowered the priority of this task from High to Medium.
Addshore set Security to None.
Addshore updated the task description. (Show Details)
Addshore moved this task from Incoming to Ready on the Addwiki board.

I've just implemented a basic OAuth support here: https://github.com/Tpt/ia-upload/tree/master/src/IaUpload/OAuth

It may be nice to improve it and move it into an addwiki library or a part of addwiki/mediawikiapi-base

About the overall architecture we have two possible ways:

  • build using an hacky way a MediawikiApi object with a Client that adds the OAuth token and still allow the library user to call method like login() on it.
  • creates an OAuthMediawikiApi that would be only compatible with OAuth authentification and without support for login() and logout. I find this way far cleaner but it may require in order to be properly implemented to move out the login() and logout method from MediawikiApiInterface to a sub-interface only implemented by the no-oauth implementation.

@Tpt I think it would make more sense to do it the cleaner way :)
Perhaps MediawikiApi needs to be reworked to accept some kind of Authentication object. One of which would be user & pass and another of which could be OAuth?

Perhaps MediawikiApi needs to be reworked to accept some kind of Authentication object.

That's definitely something to consider. But an issue is that user&pass authentication is more on the Request/Response level (do a call to action=login) and OAuth is more on the HTTP level (add the relevant header and sign the messages).

So, if we want to use the Guzzle OAuth middleware, going in this direction would require to change the Client stack used by MediawikiApi class when a possible "OAuthAuthentication" instance is given.

Addshore renamed this task from [Addwiki] [mediawiki-api-base] Add OAuth support to [mediawiki-api-base] Add OAuth support.Sep 12 2016, 8:00 AM

So I just took a look at this and I think I will release version 2.3.0 soon.

3.0.0 will then include oauth support. Probably going down the route of some sort of Authentication object.

3.0.0 will then include oauth support. Probably going down the route of some sort of Authentication object.

Great! Thank you! Feel free to reuse parts of https://github.com/wikisource/ia-upload/tree/master/src/IaUpload/OAuth if you want.

What's the status of this? I might be interested in helping with it. Is the idea that OAuth functionality in addwiki/mediawiki-api-base would make mediawiki/oauthclient redundant?