Manual:Pywikibot/OAuth

MediaWiki supports OAuth v1.0a as a method of authentication. Pywikibot also supports OAuth for MediaWiki.

More information about OAuth support of MediaWiki: OAuth/For_Developers

Requirements

 * The site with Extension:OAuth installed and configured properly
 * Python library mwoauth 0.2.4

Configuration
OAuth tokens are set in authenticate of user-config.py: authenticate['en.wikipedia.org'] = ('consumer_key','consumer_secret', 'access_key', 'access_secret') For now, we should use site's host URL as the key of dict to specifying OAuth tokens. Also, Pywikibot supports wildcard '*' as the prefix of URL: authenticate['*.wikipedia.org'] = ('consumer_key','consumer_secret', 'access_key', 'access_secret') Pywikibot will match the best OAuth tokens for requests.

The OAuth tokens could be generated at. In case of a wikifarm, this needs to be the central wiki of the farm. In case of Wikimedia, it's m:Special:OAuthConsumerRegistration/propose. You need to check the option "owner-only".

Usage
When there's OAuth tokens matched in user-config.py, Pywikibot will disable password login automatically and use OAuth tokens for authentication instead.

NOTE: Using OAuth will block logout function.