Skip to main content

Django authentication middle ware using Firebase Authentication Service

Project description

Django Firebase Auth

Project provide Django authentication middle ware using Firebase Authentication Service

Requirements

Installation

pip install django-firebase-auth

Generate Firebase Credentials

Usage

Settings

1. Setting credentials

  • Credentials from file
FIREBASE_CREDENTIALS_FILE = '<YOUR FIREBASE CREDENTIALS PATH>'  # 'firebase-credentials.json'
  • or using credentials from json dict (where you can use as environment variables )
Using credentials from json dict
FIREBASE_CREDENTIALS_DICT = {
    "type": "service_account",
    "project_id": "<YOUR PROJECT ID>",
    "private_key_id": "<YOUR PRIVATE KEY ID>",
    "private_key": '<YOUR PRIVATE KEY>',
    "client_email": "<CLIENT EMAIL>",
    "client_id": "<CLIENT ID>",
    "auth_uri": "https://accounts.google.com/o/oauth2/auth",
    "token_uri": "https://oauth2.googleapis.com/token",
    "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
    "client_x509_cert_url": "<CERT URL>"
}

2. Add installed apps:

INSTALLED_APPS = [
    "...",
    "django_firebase_auth",
]

3. Setting authentication backend

REST_FRAMEWORK = {
    "DEFAULT_AUTHENTICATION_CLASSES": (
        "django_firebase_auth.firebase_auth.FirebaseAuthentication",
    ),
}

Generate Firebase Credentials file

To generate a private key file for your service account:

  1. In the Firebase console, open Settings > Service Accounts.
  2. Click Generate New Private Key, then confirm by clicking Generate Key.
  3. Securely store the JSON file containing the key.

Add Firebase credentials to settings.py

Generate Firebase credentials from Firebase console img.png

TODO:

  • Support supabase
  • Optimize session management

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_firebase_auth-1.2.3.tar.gz (9.8 kB view details)

Uploaded Source

Built Distribution

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

django_firebase_auth-1.2.3-py3-none-any.whl (13.8 kB view details)

Uploaded Python 3

File details

Details for the file django_firebase_auth-1.2.3.tar.gz.

File metadata

  • Download URL: django_firebase_auth-1.2.3.tar.gz
  • Upload date:
  • Size: 9.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.21

File hashes

Hashes for django_firebase_auth-1.2.3.tar.gz
Algorithm Hash digest
SHA256 d4f753155d3eadb35859b02a948aa1200483f4bf23db8250e0b59777a1fc5939
MD5 d9f0631b296013dce84f4208e7fa705b
BLAKE2b-256 a66251d497d5046b5391682e94f62240510c27bbd93f9f606ac3ba85b98e8a51

See more details on using hashes here.

File details

Details for the file django_firebase_auth-1.2.3-py3-none-any.whl.

File metadata

File hashes

Hashes for django_firebase_auth-1.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5df83d9b152a41f424d6dabbaf7b9c5793e248d22d3c69dd3068267086577cfd
MD5 45fe985a9fc55c0d248808e4459123ab
BLAKE2b-256 4be9f3d20aaee92b9ee00368f2ed4ea87e96eceedfd415c322c3aacd1eb0b0fa

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