Metadata-Version: 2.1
Name: django-discord-oauth2
Version: 0.2.0
Summary: Django application for secure user authorisation using Discord OAuth2
Home-page: https://github.com/mrf0rtuna4/django-discord-oauth2
Author: mr_f0rtuna4
Author-email: heypers.team@gmail.com
License: Apache License 2.0
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.2
Classifier: Framework :: Django :: 3.0
Classifier: Framework :: Django :: 3.2
Classifier: Framework :: Django :: 4.0
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Communications :: Chat
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Internet :: WWW/HTTP :: Dynamic Content
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: Django>=2.2
Requires-Dist: requests

<!--
Copyright 2024 mr_fortuna

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->

# 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'
   ```

<details>
<summary>How to get these variables?</summary>

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)

</details>

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