<a id="mediawiki-oauth1-backend"></a>

# MediaWiki OAuth1 backend

<a id="backend-class"></a>

## Backend class

For Django, add this class path to `AUTHENTICATION_BACKENDS`. For other
integrations, use the same class path in the framework-specific backend
setting.

| Backend name   | Class path                                 |
|----------------|--------------------------------------------|
| `mediawiki`    | `social_core.backends.mediawiki.MediaWiki` |

<a id="usage"></a>

## Usage

In addition to the general setup you need to define the
following settings:

```default
SOCIAL_AUTH_MEDIAWIKI_KEY = <consumer_key>
SOCIAL_AUTH_MEDIAWIKI_SECRET = <consumer_secret>
SOCIAL_AUTH_MEDIAWIKI_URL = 'https://meta.wikimedia.org/w/index.php'
```

In the OAuth consumer registration you can choose the option to:

> Allow consumer to specify a callback in requests
> and use “callback” URL above as a required prefix

This is preferable. If your URL is https://myurl.org/ use
the following option:

```default
SOCIAL_AUTH_MEDIAWIKI_CALLBACK = \
    'https://myurl.org/oauth/complete/mediawiki'
```

But it is also possible to use:

```default
SOCIAL_AUTH_MEDIAWIKI_CALLBACK = 'oob'
```

<a id="general-documentation"></a>

## General documentation

[https://www.mediawiki.org/wiki/Extension:OAuth](https://www.mediawiki.org/wiki/Extension:OAuth)

<a id="developer-documentation"></a>

## Developer documentation

[https://www.mediawiki.org/wiki/OAuth/For_Developers](https://www.mediawiki.org/wiki/OAuth/For_Developers)

<a id="code-based-on"></a>

## Code based on

[https://github.com/mediawiki-utilities/python-mwoauth](https://github.com/mediawiki-utilities/python-mwoauth)

<a id="external-memberships"></a>

## External memberships

See [External groups](../groups.html.md) for opt-in extraction, group-based login restrictions, and
local group synchronization. No separate extraction pipeline step is needed.
