semvec/pypi-packages huggingface dataset:
firebase-user-auth 0.3.7
Custom Django Rest Framework authentication backend for parsing Firebase uid tokens and storing as local users.
License: MIT License

# DRF Firebase Auth


## Requirements
* Python
* Django
* Django Rest Framework


## Installation

```
$ pip install firebase-user-auth
```

Add the application to your project's `INSTALLED_APPS` in `settings.py`.

```
INSTALLED_APPS = [
    ...
    'firebase_user_auth',
    'users',
]
```

Add this line to `settings.py`.
```
AUTH_USER_MODEL = 'users.CustomUser'
```

In your project's `settings.py`, add this to the `REST_FRAMEWORK` configuration.

```
REST_FRAMEWORK = {
  ...
  'DEFAULT_AUTHENTICATION_CLASSES': [
    ...
    'tonic_drf_firebase.authentication.FirebaseAuthentication',
  ]
}
```


The `tonic_drf_firebase` application comes with the following settings as default, which can be overridden in your project's `settings.py` file.


```
DRF_FIREBASE_AUTH = {
    # path to JSON file with firebase secrets
    'FIREBASE_SERVICE_ACCOUNT_KEY': '',
    # allow creation of new local user in db
    'FIREBASE_CREATE_LOCAL_USER': True,
    # attempt to split firebase user.display_name and set local user
    # first_name and last_name
    'FIREBASE_ATTEMPT_CREATE_WITH_DISPLAY_NAME': True,
    # commonly JWT or Bearer (e.g. JWT <token>)
    'FIREBASE_AUTH_HEADER_PREFIX': 'JWT',
    # verify that JWT has not been revoked
    'FIREBASE_CHECK_JWT_REVOKED': True,
    # require that firebase user.email_verified is True
    'FIREBASE_AUTH_EMAIL_VERIFICATION': False
}
```

You can get away with leaving all the settings as default except for `FIREBASE_SERVICE_ACCOUNT_KEY`, which is obviously required. As a minimum, you will need to set this in your project's `settings.py`. This must be the JSON service account key that you receive from the Firebase console for your application.

```
...
DRF_FIREBASE_AUTH = {
    'FIREBASE_SERVICE_ACCOUNT_KEY': 'project/config/firebase.json'
}
```

All you need to do now is have your client code handle the Firebase popup/redirect authentication flow, retrieve the idToken from the currentUser (Firebase explains this flow well in their docs: `https://firebase.google.com/docs/auth/admin/verify-id-tokens`), and then use the idToken for the user in an `Authorization` header in requests to your API.

```
JWT <token>
```

## Based on

```
https://github.com/garyburgmann/drf-firebase-auth
```

## Source

```
https://pypi.org/project/firebase-user-auth/
```

## Update Library

```
python setup.py sdist
```

```
python -m twine upload dist/*
```
tonicapp-users 0.3.4
Users model.
License: MIT License

# Users model

## Important
It's highly recommended to set up a custom User model when starting a new Django project. Without it, you will need to create another model (like UserProfile) and link it to the Django User model with a OneToOneField if you want to add new fields to the User model.
```
DO NOT apply the migrations. Remember: You must create the custom User model before you apply your first migration.
```

## Requirements
* Python
* Django
* Django Rest Framework


## Installation

```
$ pip install tonicapp-users
```

Add the application to your project's `INSTALLED_APPS` in `settings.py`.

```
AUTH_USER_MODEL = 'users.CustomUser'
```
You can now reference the User model with either get_user_model() or settings.AUTH_USER_MODEL. Refer to Referencing the User model from the official docs for more info.


```
INSTALLED_APPS = [
    ...
    'users',
]
```

## Source

```
https://pypi.org/project/tonicapp-users/
```

## Update Library

```
python setup.py sdist
```

```
python -m twine upload dist/*
```