Metadata-Version: 2.1
Name: django_graphene_firebase_auth
Version: 0.0.32
Summary: Authentication provider for graphene-django and Google Firebase's Authentication service.
Home-page: https://github.com/eba-alemayehu/graphene-django-firebase-auth
Author: Eba Alemayehu
Author-email: ebaalemayhu3@gmail.com
License: MIT
Keywords: graphene django firebase auth
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Web Environment
Classifier: Framework :: Django
Classifier: Framework :: Django :: 2.1
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.7
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: License :: OSI Approved :: MIT License
License-File: LICENSE
Requires-Dist: django
Requires-Dist: firebase-admin

# 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
```

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

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

4. Add the authentication backend to `AUTHENTICATION_BACKENDS`:

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

5. Add `firebase_auth` to `INSTALLED_APPS`:

```python
INSTALLED_APPS = [
'firebase_auth',
]
```

6. Add `FirebaseAuthMixin` to your `AUTH_USER_MODEL`:

```python
class User(PermissionsMixin, FirebaseAuthMixin):
```

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

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

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

4. Enter the virtual environment:

```sh
./manage.py shell
```

### Other commands

```sh
# Run the tests
./manage.py test
```

```sh
# Lint the code
./lint.sh
```
