semvec/pypi-packages huggingface dataset:
django-firebase-authentication 1.0.9
A DRF authentication provider for Google Firebase AS.
License: BSD License

==============================
django-firebase-authentication
==============================

django-firebase-authentication is an auth provider for `Firebase Authentication Service <https://firebase.google.com/products/auth/>`_.

Installation
------------

Install via pip::

    pip install django-firebase-authentication

Also installed dependencies:
`django-rest-framework <https://github.com/encode/django-rest-framework/>`_ and
`firebase-admin <https://github.com/firebase/firebase-admin-python/>`_.

Django setup
------------
1. Add "firebase_auth" to your INSTALLED_APPS::

    INSTALLED_APPS = [
        ...
        'firebase_authentication',
    ]

2. Specify a location for your Firebase keyfile with the settings::

    FIREBASE_PATH = os.path.join(BASE_DIR, 'keyfile.json')

   And place the json key inside ``BASE_DIR``.

3. Specify default auth model in settings::

    AUTH_USER_MODEL = 'firebase_authentication.User'

3. Add FirebaseAuthentication to default authentication classes in DRF settings, like::

    REST_FRAMEWORK = {
        'DEFAULT_AUTHENTICATION_CLASSES': (
            'firebase_authentication.authentication.FirebaseAuthentication',
        ),
    }

   Or use ``FirebaseAuthMixin`` in DRF views like::

    from firebase_auth.mixins import FirebaseAuthMixin
    class MyModelViewSet(FirebaseAuthMixin, viewsets.ModelViewSet)
        ...

   **Attention!** This mixin must be first in inheritance order.

4. Add FirebaseAuthMiddleware to MIDDLEWARE list instead of default session middleware::

    MIDDLEWARE = [
        ...
        # 'django.contrib.auth.middleware.AuthenticationMiddleware',
        'firebase_authentication.authentication.FirebaseAuthMiddleware',
        ...
    ]