django-firebase-authentication-1.0.9
توضیحات
A DRF authentication provider for Google Firebase AS.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | django-firebase-authentication-1.0.9 |
| نام | django-firebase-authentication |
| نسخه کتابخانه | 1.0.9 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | floydya |
| ایمیل نویسنده | xfloydya@gmail.com |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/django-firebase-authentication/ |
| مجوز | 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',
...
]
نحوه نصب
نصب پکیج whl django-firebase-authentication-1.0.9:
pip install django-firebase-authentication-1.0.9.whl
نصب پکیج tar.gz django-firebase-authentication-1.0.9:
pip install django-firebase-authentication-1.0.9.tar.gz