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
Hashes for django_graphene_firebase_auth-0.0.31.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 716548648f2a2514c2fce61352271c9fde64f42ebab371aa9f8c0fa190f66775 |
|
MD5 | 7cb8d39034129dae7f4be45c688646e1 |
|
BLAKE2b-256 | a7107b5bd93465278a74b00a7948d668a23d1d1d36b735675350c4dc454a5913 |
Hashes for django_graphene_firebase_auth-0.0.31-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83120f9dc0ec0d7771c83c830aef63e781b3591f2df7f83638d49493fe9e48f4 |
|
MD5 | e0a381d23cbd093e6a43ff839a714870 |
|
BLAKE2b-256 | a755fae0bf102c3c07ef6324cf00638e2dcc47ce9a2d2b7a478b9f5fc3c13875 |