Skip to main content

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

Metadata

Release files for django-firebase-auth 1.2.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-firebase-auth 1.2.4
File Size Uploaded Provenance
django_firebase_auth-1.2.4.tar.gz 9.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for django-firebase-auth 1.2.4
File Interpreter ABI Platform
django_firebase_auth-1.2.4-py3-none-any.whl Python 3 none any Details

Total release size: 23.8 kB

Release files / django_firebase_auth-1.2.4.tar.gz

Download URL django_firebase_auth-1.2.4.tar.gz
Size 9.9 kB
Tags Source
SHA-256 checksum
How to use checksums
c5117a527396c51298d4508710a8593a5d31bac759842ac3a71a4c45b2e89fdc
BLAKE2b-256 checksum
How to use checksums
a109a10d50a683d0f5ba1736ca1a7e325b917e8e95551aa9bf634bcd4fcc850b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Release files / django_firebase_auth-1.2.4-py3-none-any.whl

Download URL django_firebase_auth-1.2.4-py3-none-any.whl
Size 13.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a7ed685e1f09e7753fc301973744a052ae56f7e85e7943857555bc07b4a310fc
BLAKE2b-256 checksum
How to use checksums
8fa8d4a06071e97809b9ce73b10350a1eb68b52c2ec371564dca7aa787744285
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.9.23

Security for django-firebase-auth 1.2.4

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page