<a id="mail-ru-oauth"></a>

# Mail.ru OAuth

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

## Backend classes

For Django, choose from these class paths for `AUTHENTICATION_BACKENDS`.
For other integrations, use the same class paths in the
framework-specific backend setting.

| Backend name    | Class path                                 |
|-----------------|--------------------------------------------|
| `mailru-oauth2` | `social_core.backends.mailru.MailruOAuth2` |
| `mailru`        | `social_core.backends.mailru.MRGOAuth2`    |

Mail.ru uses OAuth2 workflow. [Register new application](https://oauth.mail.ru/app/) to use it and fill in settings:

```default
SOCIAL_AUTH_MAILRU_KEY = ''
SOCIAL_AUTH_MAILRU_SECRET = ''
```

Add `social_core.backends.mailru.MRGOAuth2` to `AUTHENTICATION_BACKENDS` to activate Mail.ru authorization.

The `mailru` backend identifies users by the stable `id` returned by the
userinfo endpoint. Associations created by older social-core releases used the
email address and migrate on the next successful authentication. The legacy
`mailru-oauth2` backend already uses its stable `uid` field.

<a id="legacy-oauth2-authorization"></a>

## Legacy OAuth2 authorization

Also available `social_core.backends.mailru.MailruOAuth2` for authorization with `connect.mail.ru` server.

[Create an app](https://api.mail.ru/sites/my/add) and set following settings:

```default
SOCIAL_AUTH_MAILRU_OAUTH2_KEY = ''
SOCIAL_AUTH_MAILRU_OAUTH2_SECRET = ''
```
