A Django app for Meta (Facebook) API authentication
Project description
Django MetaAuth
A Django app for Meta (Facebook) API authentication, providing an easy way to integrate Meta OAuth in your Django projects.
Features
- OAuth-based authentication flow for Meta (Facebook) API
- Token storage and management
- Ready-to-use views for installation and OAuth redirection
Installation
Install the package via pip:
pip install django-metaauth
Quick Start
- Add "metaauth" to your INSTALLED_APPS setting:
INSTALLED_APPS = [
...
'metaauth',
]
- Include the metaauth URLconf in your project urls.py:
path('meta/oauth/', include('metaauth.urls')),
-
Run
python manage.py migrateto create the metaauth models. -
Configure your Meta (Facebook) app credentials in your settings.py:
METAAUTH_FACEBOOK_APP_ID = os.getenv("METAAUTH_FACEBOOK_APP_ID")
METAAUTH_FACEBOOK_APP_SECRET = os.getenv("METAAUTH_FACEBOOK_APP_SECRET")
METAAUTH_FACEBOOK_REDIRECT_URI = os.getenv("METAAUTH_FACEBOOK_REDIRECT_URI")
METAAUTH_FACEBOOK_CONFIG_ID = os.getenv("METAAUTH_FACEBOOK_CONFIG_ID")
- Start the development server and visit http://127.0.0.1:8000/meta/oauth/install to begin the OAuth flow.
Configuration
Django MetaAuth can be configured with the following settings in your Django project's settings.py file:
| Setting | Description | Default |
|---|---|---|
| METAAUTH_FACEBOOK_APP_ID | Your Facebook App ID | None |
| METAAUTH_FACEBOOK_APP_SECRET | Your Facebook App Secret | None |
| METAAUTH_FACEBOOK_REDIRECT_URI | The redirect URI for OAuth | None |
| METAAUTH_FACEBOOK_API_VERSION | Facebook API version | 'v21.0' |
| METAAUTH_FACEBOOK_REQUIRED_SCOPES | Required permission scopes | ['ads_management', 'pages_show_list'] |
| METAAUTH_SUCCESS_URL | URL to redirect after successful auth | '/meta/oauth/success' |
| METAAUTH_ERROR_URL | URL to redirect after failed auth | '/meta/oauth/error' |
Development and Testing
Running Tests
You can run the tests without setting up a Django project:
# Run all tests
python tests.py
# Run tests with verbose output
python tests.py -v
# Run specific tests
python tests.py tests.test_models
Creating Migrations
If you need to create migrations for the app:
python makemigrations.py
License
This project is licensed under the MIT License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_metaauth-0.1.2.tar.gz.
File metadata
- Download URL: django_metaauth-0.1.2.tar.gz
- Upload date:
- Size: 10.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
baa8b6f19302ca4cc2bdcc2c4fc538345ad528e1c570f3cdac9c11a0c6401ebf
|
|
| MD5 |
f8454c1898462f16951fcc8c884088a6
|
|
| BLAKE2b-256 |
30cc6d3cbf103e7ac5bc90e9d6657e1d06a299cde08aa8b6b9289873164ad883
|
File details
Details for the file django_metaauth-0.1.2-py3-none-any.whl.
File metadata
- Download URL: django_metaauth-0.1.2-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2db90ccb47590776046e5dcbebd2335ad0d7538902e31dfd638826a4741dad63
|
|
| MD5 |
8724b0e839d744d7f09943ffd082fd8c
|
|
| BLAKE2b-256 |
dc3d9073ca26ecdf044b971403f3c173c68037e9108adf769684071f991a7770
|