Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mrf0rtuna4/django-discord-oauth2

🥢 Django application for secure user authorisation using Discord OAuth2
https://github.com/mrf0rtuna4/django-discord-oauth2

discord django oauth2 pypi

Last synced: about 9 hours ago
JSON representation

🥢 Django application for secure user authorisation using Discord OAuth2

Awesome Lists containing this project

README

        


Django & Discord Oauth2












> [!WARNING]
> App under development!!

## Installation

```bash
pip install django-discord-oauth2
```

## Usage

1. Add `django_discord_oauth2` to your `INSTALLED_APPS` setting like this:

```python
INSTALLED_APPS = [
'django_discord_oauth2',
]
```

2. Include the `django_discord_oauth2` URLconf in your project `urls.py` like this:

```python
from django.urls import include, path

urlpatterns = [
path('oauth2/', include('django_discord_oauth2.urls')),
]
```

3. Run `python manage.py migrate` to create the necessary models.

4. Add your Discord application credentials to your settings:

```python
DISCORD_CLIENT_ID = 'your_client_id'
DISCORD_CLIENT_SECRET = 'your_client_secret'
DISCORD_REDIRECT_URI = 'your_redirect_uri'
```

How to get these variables?

1. Visit [Discord Developer Portal](https://discord.com/developers/applications).
2. Create a new application or use an existing one.
3. Open the OAuth2 section in the left panel:

![image](https://github.com/user-attachments/assets/face3685-4ee8-4c9e-a706-dc634069220b)

5. Copy the CLIENT ID:

![image](https://github.com/user-attachments/assets/0e76649b-3d9b-4a5c-8744-d19fc3257d24)

7. This is your `DISCORD_CLIENT_ID`.
8. Press the "Reset Secret" button and copy the token:

![image](https://github.com/user-attachments/assets/d2b899b3-84f4-42b0-8e4f-6a72979aaa30)

10. This is your `DISCORD_CLIENT_SECRET`.
11. Add a redirect URL, for example:

![image](https://github.com/user-attachments/assets/d43dada4-cd0d-4cfe-bdea-39638cb0fee1)

5. Start the development server and visit `http://127.0.0.1:8000/oauth2/login/` to initiate the login process.

---

## Contributing

Contributions are welcome! Please read the [contributing guidelines](CONTRIBUTING.md) to get started.

## License

This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.