<a id="battle-net"></a>

# Battle.net

<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                                       |
|--------------------|--------------------------------------------------|
| `battlenet-oauth2` | `social_core.backends.battlenet.BattleNetOAuth2` |

Blizzard implemented OAuth2 protocol for their authentication mechanism. To
enable `python-social-auth` support follow this steps:

1. Go to [Battlenet Developer Portal](https://dev.battle.net/) and create an application.
2. Fill App Id and Secret in your project settings:
   ```default
   SOCIAL_AUTH_BATTLENET_OAUTH2_KEY = '...'
   SOCIAL_AUTH_BATTLENET_OAUTH2_SECRET = '...'
   ```
3. Enable the backend:
   ```default
   SOCIAL_AUTH_AUTHENTICATION_BACKENDS = (
       ...
       'social_core.backends.battlenet.BattleNetOAuth2',
       ...
   )
   ```

Note: If you want to allow the user to choose a username from their own
characters, some further steps are required, see the use cases part of the
documentation. To get the account id and battletag use the user_data function, as
[account id is no longer passed inherently](http://us.battle.net/en/forum/topic/18300183303).

Another note: If you get a 500 response “Internal Server Error” the API now requires [https on callback endpoints](http://us.battle.net/en/forum/topic/17085510584).

Further documentation at [Developer Guide](https://dev.battle.net/docs/read/oauth).
