django-discord-bind

A Django app for securely associating a user with a Discord account.

Git Repository Build Status Documentation Status

This is a simple Django application that allows users to associate one or more Discord accounts to their Django accounts and automatically join a partner Discord server using the OAuth2 functionality of the Discord API.

Requirements

  • Python 2.7, 3.4, 3.5
  • Django 1.9, 1.10

License

django-discord-bind is released under the terms of the MIT license. Full details in LICENSE file.

Contents

Installation

Install with pip:

pip install django-discord-bind

Add discord_bind to your INSTALLED_APPS setting:

INSTALLED_APPS = [
    ...
    'discord_bind',
]

Include the URL configuration in your project urls.py:

urlpatterns = [
    ...
    url(r'^discord/', include('discord_bind.urls')),
]

Run python manage.py migrate to create the discord_bind models.

Settings

Django Discord Bind has a number of settings that control its behavior.

Required Settings

DISCORD_CLIENT_ID

The client identifier issued by the Discord authorization server. This identifier is used in the authorization request of the OAuth 2.0 Authorization Code Grant workflow.

DISCORD_CLIENT_SECRET

A shared secret issued by the Discord authorization server. This identifier is used in the access token request of the OAuth 2.0 Authorization Code Grant workflow.

Optional Settings

DISCORD_AUTHZ_PATH

Default: /oauth2/authorize

The path of the authorization request service endpoint, which will be appended to the DISCORD_BASE_URI setting.

DISCORD_BASE_URI

Default: https://discordapp.com/api

The base URI for the Discord API.

DISCORD_INVITE_URI

Default: https://discordapp.com/channels/@me

The URI that the user will be redirected to after one or more successful auto-invites.

DISCORD_REDIRECT_URI

Default: reverse('discord_bind_callback')

The URI that will be passed to the Discord authorization endpoint as the URI for the callback route. Normally this is determined by Django, but it can be set manually if the application is behind a proxy.

DISCORD_RETURN_URI

Default: /

The URI that the user will be redirected to if no auto-invites are attempted or successful.

DISCORD_TOKEN_PATH

Default: /oauth2/token

The path of the access token request service endpoint, which will be appended to the DISCORD_BASE_URI setting.

Change Log

This project uses Semantic Versioning.

0.2.0 – 2016-08-19

Added

  • Added the DISCORD_REDIRECT_URI setting.
  • Added state validation to prevent CSRF attacks.

Updated

  • Added more documentation.

0.1.3 – 2016-08-14

Fixed

  • Corrected all PEP8 issues.

Updated

  • Documented all settings options.

0.1.2 – 2016-08-13

Fixed

  • Cleaned up package configuration.

Changed

  • Disabled TravisCI e-mail notifications.

0.1.1 – 2016-08-13

Fixed

  • Removed migration dependencies.
  • Cleaned up TravisCI configuration.

0.1.0 – 2016-08-13

Initial release.

Indices and tables