Skip to content

wh0th3h3llam1/drf-firebase-auth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DRF Firebase Auth

A Django REST Wrapper for Firebase Authentication with DRF.

Snapshots

Firebase Authentication Home Page Firebase Authentication Home Page

Phone Auth Phone Number Authentication - 1

Phone Auth Phone Number Authentication - 2

🎉 Features

  • ✨ Frontend built using Material Design Lite
  • ⭐ Easily Integrates with Django and Django REST Framework (DRF)
  • 🔥 Firebase Authentication included
  • Supported Authentication Methods:
    • 📲 Phone Number Authentication (Visible/Invisble reCaptcha)
    • 📧 Email Link & Email + Password Authentication
    • 🕵️ Anonymous Authentication

🗺️ Roadmap

  • 🌈Customizable color scheme
  • 🕸 Support for WebSocket Authentication with Firebase for channels

Dependencies

Python >= 3.8

Django >= 3.9

Django REST Framework

Firebase Admin Python SDK

⚙️ Installation

Git

git clone https://github.com/wh0th3h3llam1/drf-firebase-auth.git

🛠️ Firebase Authentication Setup

settings.py

Add the FirebaseAuthentication class to DEFAULT_AUTHENTICATION_CLASSES

REST_FRAMEWORK = {
    "DEFAULT_AUTHENTICATION_CLASSES": (
        "drf_firebase_auth.authentication.FirebaseAuthentication",
        "rest_framework.authentication.TokenAuthentication",
        ...
    )
    ...
}

models.py

Inherit your default User model from AbstractFirebaseUser

class User(AbstractFirebaseUser, PermissionsMixin):
    profile_image = models.ImageField(
        upload_to="user/profile_images",
        blank=True, null=True
    )
    ...

The AbstractFirebaseUser model provided is designed to be compatible with Phone Number Authentication so phone_number is a "required and unique" field.

In case it's not required, you can edit the abstract model as per your requirements

urls.py

urlpatterns = [
    ...
    path("firebase/", include("drf_firebase_auth.urls")),
    ...
]

ℹ️ Usage

⚠️ WARNING: DO NOT use in Production!

🤝 Contributing

Got any issues or suggestions?

Open a Issue

📜 Licence

MIT