Authentication provider for graphene-django and Google Firebase's Authentication service.
Project description
# graphene-django-firebase-auth
Authentication provider for graphene-django and Firebase’s Authentication service.
Note this is a WIP and abandoned project since I never ended up using Firebase. But the code is still a good starting point as of writing this.
Partially inspired by [django-firebase-auth](https://github.com/fcornelius/django-firebase-auth) for Django REST framework.
This app is used with [Firebase Authentication](https://firebase.google.com/docs/auth/) on a client.
## Compatibility
This code has only been tested with Python 3.7.0 and Django 2.1.2.
## Installing
Install the app:
`sh pipenv install graphene-django-firebase-auth `
Download the JSON file from your [Firebase console](https://console.firebase.google.com/) with your account’s credentials.
Set FIREBASE_KEY_FILE in your project’s settings to the path of the credentials file:
`python import os FIREBASE_KEY_FILE = os.path.join(BASE_DIR, 'path/to/firebase-credentials.json') `
Add the authentication backend to AUTHENTICATION_BACKENDS:
`python AUTHENTICATION_BACKENDS = ['firebase_auth.authentication.FirebaseAuthentication'] `
Add firebase_auth to INSTALLED_APPS:
`python INSTALLED_APPS = [ 'firebase_auth', ] `
Add FirebaseAuthMixin to your AUTH_USER_MODEL:
`python class User(PermissionsMixin, FirebaseAuthMixin): `
Build and run your DB migrations to add the changes:
`sh ./manage.py makemigrations ./manage.py migrate `
## Sending tokens on the client
Your client will need to send an Authorization: Bearer token on each request. How you do this depends on your client and is outside the scope of this documentation.
## Developing
### Setting up your environment
Install the dependencies:
`sh pipenv install -d `
Download the JSON file from your [Firebase console](https://console.firebase.google.com/) with your account’s credentials.
Create an .env file using .env.example as a template. Make sure to specify the path to the file in the previous step.
Enter the virtual environment:
`sh ./manage.py shell `
### Other commands
`sh # Run the tests ./manage.py test `
`sh # Lint the code ./lint.sh `
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_graphene_firebase_auth-0.0.28.tar.gz
.
File metadata
- Download URL: django_graphene_firebase_auth-0.0.28.tar.gz
- Upload date:
- Size: 4.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f3871398d0a0f874b8e066841d09061deae25666989373156a3bab831b23044 |
|
MD5 | 11d2e74a705fd60203841c67987857d6 |
|
BLAKE2b-256 | 416d5b26f39c2e4ef22e05b0503c4f6d8b6d38a03db413315395fabaa33a25dc |
File details
Details for the file django_graphene_firebase_auth-0.0.28-py3-none-any.whl
.
File metadata
- Download URL: django_graphene_firebase_auth-0.0.28-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.18
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 191eccb9709342c982a7b241ab905e359e6d517b722ddbc63938afffa2539217 |
|
MD5 | bbdd1e212f873d39e0795b5d184a2c1c |
|
BLAKE2b-256 | 20ed22cfbc8beee424bdfc1e77d69fe86faafca41e5addc1a44e1b6202cccfe4 |