Skip to main content

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

  1. Install the app:

`sh pipenv install graphene-django-firebase-auth `

  1. Download the JSON file from your [Firebase console](https://console.firebase.google.com/) with your account’s credentials.

  2. 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') `

  1. Add the authentication backend to AUTHENTICATION_BACKENDS:

`python AUTHENTICATION_BACKENDS = ['firebase_auth.authentication.FirebaseAuthentication'] `

  1. Add firebase_auth to INSTALLED_APPS:

`python INSTALLED_APPS = [ 'firebase_auth', ] `

  1. Add FirebaseAuthMixin to your AUTH_USER_MODEL:

`python class User(PermissionsMixin, FirebaseAuthMixin): `

  1. 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

  1. Install the dependencies:

`sh pipenv install -d `

  1. Download the JSON file from your [Firebase console](https://console.firebase.google.com/) with your account’s credentials.

  2. Create an .env file using .env.example as a template. Make sure to specify the path to the file in the previous step.

  3. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_graphene_firebase_auth-0.0.26.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file django_graphene_firebase_auth-0.0.26.tar.gz.

File metadata

File hashes

Hashes for django_graphene_firebase_auth-0.0.26.tar.gz
Algorithm Hash digest
SHA256 51a41b5d1144aec9e60f17272989b28b5ee744d059576fdbde53eb419e9d6538
MD5 4d1811c84e9b2e5e7cb3db1ded8f76d1
BLAKE2b-256 93d779efa96c78f021ae1ab6a8e0ab9dfcc773d87ba0af6d991130cb85b8d7f1

See more details on using hashes here.

File details

Details for the file django_graphene_firebase_auth-0.0.26-py3-none-any.whl.

File metadata

File hashes

Hashes for django_graphene_firebase_auth-0.0.26-py3-none-any.whl
Algorithm Hash digest
SHA256 e634b3150ee162f3ddbf8ec02d7c92e4e804bf27b12b1874a136ecbdb87389c2
MD5 10fa06114884011b70e56c4e70e0cba4
BLAKE2b-256 1a6daff8d1db08a82269c67cef3ff9979fda1681398b6a132857b52049bf73e7

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