Skip to main content

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

  1. Add "metaauth" to your INSTALLED_APPS setting:
INSTALLED_APPS = [
    ...
    'metaauth',
]
  1. Include the metaauth URLconf in your project urls.py:
path('meta/oauth/', include('metaauth.urls')),
  1. Run python manage.py migrate to create the metaauth models.

  2. 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")
  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_metaauth-0.1.0.tar.gz (10.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_metaauth-0.1.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file django_metaauth-0.1.0.tar.gz.

File metadata

  • Download URL: django_metaauth-0.1.0.tar.gz
  • Upload date:
  • Size: 10.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.15

File hashes

Hashes for django_metaauth-0.1.0.tar.gz
Algorithm Hash digest
SHA256 dc30b05a26a3978d9a40dcdbb0d6e21db477d522979a438e10b092120f777399
MD5 01badb15502034149eb490f5ce8f21af
BLAKE2b-256 4629c38800ee1204067dd9d954efd772d42af15405ac7cc12106385de972e182

See more details on using hashes here.

File details

Details for the file django_metaauth-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_metaauth-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f0a5bce6cf824e903ce84e539eef3f1f8bf2602d232e0c5a9d173aa11c6baae9
MD5 1ce9ed366f82a3cd2e8972554b9f0b64
BLAKE2b-256 a8cf8eaceb3a3a5f35d0ba41d44d8682008f3475bee8f0b06634b64b5019bfb4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page