Skip to main content

This package is complete tools for sass building

Project description

DRF Easily Saas

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-saas
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_saas',
]

Add a Easily configuration

EASILY= {
    'auth_provider': 'firebase', # Required
    'payment_provider': 'stripe', # Required
    'frontend_url': 'http://localhost:3000', # Required
    'firebase_config': {
        'import_users': True,
        "hot_reload_import": False,
        'config': {
            "type": "service_account",
            "project_id": "o-380604",
            "private_key_id": "7b9b5b20483ccbb91e",
            "private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANAQEFAASCBKYwggSiAgEAAoIBAQC1Mv+HbJi7ObeG\nLGAhYXS7gf+O+9gMPYQWgM6KZqvd2dhvuqxyzqJYttz5o55YKBZTFDdY5Kped51f\nU273RylDA6\nWsbW9xyvgmVpbIbja29Lhc1H1Hymd4edFfDdee/d9LTF8g8QNHJ5LFx\n0DvORqNuNh0rM78sQS9l+g9PNdCoBTWxXE8BRvUCgYB2PXGAGCVDeesKxDyR3hwj\nVxR0un/5KMjJgpChhPBwNFLtar6WrgQVMYZomCwh9xjTAh/69lxtzaxJ+mvz3A8X\n1waeyUrsd+aBviq0Yz/6JVDghOkY5ZrptcR3Dg0hHLkEg0QLixmWebUQnZ6knW7z\n38m94Msowc2s2N6uYVE63g==\n-----END PRIVATE KEY-----\n",
            "client_email": "firebase-adminsdk-i7799@oting-380604.iam.gserviceaccount.com",
            "client_id": "106479259625371201589",
            "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": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-i7799%-380604.iam.gserviceaccount.com",
            "universe_domain": "googleapis.com"
        },
    },
    'stripe_config': {
        'public_key': os.getenv('STRIPE_PUBLIC_KEY'),
        'secret_key': os.getenv('STRIPE_SECRET_KEY'),
        'webhook_verif_strategy': 'apikey',
        'subscription': {
            'payment_method_types': ['card', 'paypal'],
            'billing_address_collection': 'auto',
            'shipping_address_collection': {
                'allowed_countries': ['US', 'CA', 'FR'],
            },
            'automatic_tax': {'enabled': True},
        },
    },
}

Configure custom Firebase authentication in rest framework

'DEFAULT_AUTHENTICATION_CLASSES': [
    'drf_easily_saas.auth.firebase.protect.FirebaseAuthentication',
],

Sync all existing users from your Firebase database

python3 manage.py syncfirebaseusers

Have fun with Firebase Authentication! 🚀

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

drf_easily_saas-0.0.3.tar.gz (35.1 kB view details)

Uploaded Source

Built Distribution

drf_easily_saas-0.0.3-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file drf_easily_saas-0.0.3.tar.gz.

File metadata

  • Download URL: drf_easily_saas-0.0.3.tar.gz
  • Upload date:
  • Size: 35.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.10.12 Linux/6.5.0-28-generic

File hashes

Hashes for drf_easily_saas-0.0.3.tar.gz
Algorithm Hash digest
SHA256 b6e69c2d47a5b5428e49b47d2eacaa13ad0f1f286050d46eed34ba34d40ae983
MD5 d949e6d2271fdb6a964c2bc6292f6465
BLAKE2b-256 ea1636a4836d21f046e1bd30d362ed577be249d3b939dca436dec7fbbfed4c02

See more details on using hashes here.

File details

Details for the file drf_easily_saas-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: drf_easily_saas-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.0 CPython/3.10.12 Linux/6.5.0-28-generic

File hashes

Hashes for drf_easily_saas-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c2b760fb2bc2c103a81b7735307acde7309bbe8a72b684f37bc1740dfaec4d46
MD5 62fbf8a11929ab49a8e78033f4b1a628
BLAKE2b-256 e7becc83eb5959cac7bf10aebd9cee1454611e0d43e1b93356fa98414d6c3b7d

See more details on using hashes here.

Supported by

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