# DRF Firebase Auth
This package allows integration with Firebase for authentication outside the Django context.
![Firebase Logo](https://miro.medium.com/max/300/1*R4c8lHBHuH5qyqOtZb3h-w.png)
## 1. Firebase configuration
Create your [Firebase](https://console.firebase.google.com/) database, then download the `.json` authentication file linked to your project.
- Go to `Project settings`
- Then go to the `Service accounts` section
- Select `Python` then download by clicking on `Generate new private key`
- Upload the `.json` file into your Django project
## 2. Django configuration
**Install authentication app in your project**
```bash
pip install drf-easily-auth
```
```bash
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
# Insert this app
'drf_easily_auth',
]
```
Add a Firebase configuration
```bash
FIREBASE_CONFIG_FILE = # Your Firebase config file path downloaded in step 1
```
Or
```bash
FIREBASE_CONFIG_FILE = {
apiKey: "AIqdqdymodlwEXOOdddVbacklbBXrNjwu6Mg",
authDomain: "oting-38060qddqdq4.firebaseapp.com",
projectId: "oting-3806dqdqdq04",
storageBucket: "oting-380604.appspt.com",
messagingSenderId: "3430090dqd20511",
appId: "1:343009511:web:e49dqdqd421ed29ea"
}
```
**Configure custom Firebase authentication in rest framework**
```bash
'DEFAULT_AUTHENTICATION_CLASSES': [
'drf_easily_auth.firebase.auth.FirebaseAuthentication',
],
```
**Sync all existing users from your Firebase database**
```bash
python3 manage.py syncfirebaseusers
```
---
Have fun with Firebase Authentication! 🚀
Raw data
{
"_id": null,
"home_page": "https://github.com/alexandre-meline/drf_easily_auth/",
"name": "drf-easily-auth",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.10",
"maintainer_email": null,
"keywords": "Django, Firebase, Authentication, User Synchronization, DRF, Python, User Management, Security, API, JSON Web Tokens",
"author": "Alexandre Meline",
"author_email": "alexandre.meline.dev@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/6f/46/ef137d1e93fade1c8bb54ab6016ff5f6179037ec74040505abab8c83ef37/drf_easily_auth-0.2.0.tar.gz",
"platform": null,
"description": "# DRF Firebase Auth\n\nThis package allows integration with Firebase for authentication outside the Django context.\n\n![Firebase Logo](https://miro.medium.com/max/300/1*R4c8lHBHuH5qyqOtZb3h-w.png)\n\n## 1. Firebase configuration\n\nCreate your [Firebase](https://console.firebase.google.com/) database, then download the `.json` authentication file linked to your project.\n\n- Go to `Project settings`\n- Then go to the `Service accounts` section\n- Select `Python` then download by clicking on `Generate new private key`\n- Upload the `.json` file into your Django project\n\n## 2. Django configuration\n\n**Install authentication app in your project**\n\n```bash\npip install drf-easily-auth\n```\n\n```bash\nINSTALLED_APPS = [\n 'django.contrib.admin',\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.messages',\n 'django.contrib.staticfiles',\n\n # Insert this app\n 'drf_easily_auth',\n]\n```\n\nAdd a Firebase configuration\n\n```bash\nFIREBASE_CONFIG_FILE = # Your Firebase config file path downloaded in step 1\n```\n\nOr\n\n```bash\nFIREBASE_CONFIG_FILE = {\n apiKey: \"AIqdqdymodlwEXOOdddVbacklbBXrNjwu6Mg\",\n authDomain: \"oting-38060qddqdq4.firebaseapp.com\",\n projectId: \"oting-3806dqdqdq04\",\n storageBucket: \"oting-380604.appspt.com\",\n messagingSenderId: \"3430090dqd20511\",\n appId: \"1:343009511:web:e49dqdqd421ed29ea\"\n}\n```\n\n\n**Configure custom Firebase authentication in rest framework**\n\n```bash\n'DEFAULT_AUTHENTICATION_CLASSES': [\n 'drf_easily_auth.firebase.auth.FirebaseAuthentication',\n],\n```\n\n**Sync all existing users from your Firebase database**\n\n```bash\npython3 manage.py syncfirebaseusers\n```\n\n---\n\nHave fun with Firebase Authentication! \ud83d\ude80\n",
"bugtrack_url": null,
"license": null,
"summary": "This package allows integration with Firebase for authentication outside the Django context.",
"version": "0.2.0",
"project_urls": {
"Homepage": "https://github.com/alexandre-meline/drf_easily_auth/"
},
"split_keywords": [
"django",
" firebase",
" authentication",
" user synchronization",
" drf",
" python",
" user management",
" security",
" api",
" json web tokens"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "b504e7fd3923d340128d3dff79259c25d08624f6f54d8f38b3a56d6a7fad9d71",
"md5": "783f63bc97e09e85b8f89112bd4eb8b8",
"sha256": "68fc1317b8a96b90085d56eecb200a0203e8db9ed601fb2877bb47e0faf70b18"
},
"downloads": -1,
"filename": "drf_easily_auth-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "783f63bc97e09e85b8f89112bd4eb8b8",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 7412,
"upload_time": "2024-04-24T17:32:46",
"upload_time_iso_8601": "2024-04-24T17:32:46.226207Z",
"url": "https://files.pythonhosted.org/packages/b5/04/e7fd3923d340128d3dff79259c25d08624f6f54d8f38b3a56d6a7fad9d71/drf_easily_auth-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "6f46ef137d1e93fade1c8bb54ab6016ff5f6179037ec74040505abab8c83ef37",
"md5": "0c0c108c9c56efcd52bb57d7cf749b5c",
"sha256": "b59e42a68e5e894886fce7c6d7d6d4a27324ad1acce7981c06075d9c29cec078"
},
"downloads": -1,
"filename": "drf_easily_auth-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "0c0c108c9c56efcd52bb57d7cf749b5c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 5323,
"upload_time": "2024-04-24T17:32:47",
"upload_time_iso_8601": "2024-04-24T17:32:47.875801Z",
"url": "https://files.pythonhosted.org/packages/6f/46/ef137d1e93fade1c8bb54ab6016ff5f6179037ec74040505abab8c83ef37/drf_easily_auth-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-24 17:32:47",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "alexandre-meline",
"github_project": "drf_easily_auth",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "drf-easily-auth"
}