🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more

drf-easily-auth

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

drf-easily-auth

This package allows integration with Firebase for authentication outside the Django context.

0.2.0
Maintainers
1

DRF Firebase Auth

This package allows integration with Firebase for authentication outside the Django context.

Firebase Logo

1. Firebase configuration

Create your Firebase database, then download the .json authentication file linked to your project.

  • Go to Project settings
  • Then go to the Service accounts section
  • Select Python then download by clicking on Generate new private key
  • Upload the .json file into your Django project

2. Django configuration

Install authentication app in your project

pip install drf-easily-auth
INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',

    # Insert this app
    'drf_easily_auth',
]

Add a Firebase configuration

FIREBASE_CONFIG_FILE = # Your Firebase config file path downloaded in step 1

Or

FIREBASE_CONFIG_FILE = {
  apiKey: "AIqdqdymodlwEXOOdddVbacklbBXrNjwu6Mg",
  authDomain: "oting-38060qddqdq4.firebaseapp.com",
  projectId: "oting-3806dqdqdq04",
  storageBucket: "oting-380604.appspt.com",
  messagingSenderId: "3430090dqd20511",
  appId: "1:343009511:web:e49dqdqd421ed29ea"
}

Configure custom Firebase authentication in rest framework

'DEFAULT_AUTHENTICATION_CLASSES': [
    'drf_easily_auth.firebase.auth.FirebaseAuthentication',
],

Sync all existing users from your Firebase database

python3 manage.py syncfirebaseusers

Have fun with Firebase Authentication! 🚀

FAQs

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts