# DRF Easily Saas
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_saas',
]
```
Add a Easily configuration
```python
EASILY= {
'auth_provider': 'firebase', # Required
'payment_provider': 'stripe', # Required
'frontend_url': 'http://localhost:3000', # Required
'firebase_config': {
'import_users': True,
"hot_reload_import": False,
'config': {
"type": "service_account",
"project_id": "o-380604",
"private_key_id": "7b9b5b20483ccbb91e",
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvAIBADANAQEFAASCBKYwggSiAgEAAoIBAQC1Mv+HbJi7ObeG\nLGAhYXS7gf+O+9gMPYQWgM6KZqvd2dhvuqxyzqJYttz5o55YKBZTFDdY5Kped51f\nU273RylDA6\nWsbW9xyvgmVpbIbja29Lhc1H1Hymd4edFfDdee/d9LTF8g8QNHJ5LFx\n0DvORqNuNh0rM78sQS9l+g9PNdCoBTWxXE8BRvUCgYB2PXGAGCVDeesKxDyR3hwj\nVxR0un/5KMjJgpChhPBwNFLtar6WrgQVMYZomCwh9xjTAh/69lxtzaxJ+mvz3A8X\n1waeyUrsd+aBviq0Yz/6JVDghOkY5ZrptcR3Dg0hHLkEg0QLixmWebUQnZ6knW7z\n38m94Msowc2s2N6uYVE63g==\n-----END PRIVATE KEY-----\n",
"client_email": "firebase-adminsdk-i7799@oting-380604.iam.gserviceaccount.com",
"client_id": "106479259625371201589",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-i7799%-380604.iam.gserviceaccount.com",
"universe_domain": "googleapis.com"
},
},
'stripe_config': {
'public_key': os.getenv('STRIPE_PUBLIC_KEY'),
'secret_key': os.getenv('STRIPE_SECRET_KEY'),
'webhook_verif_strategy': 'apikey',
'subscription': {
'payment_method_types': ['card', 'paypal'],
'billing_address_collection': 'auto',
'shipping_address_collection': {
'allowed_countries': ['US', 'CA', 'FR'],
},
'automatic_tax': {'enabled': True},
},
},
}
```
**Configure custom Firebase authentication in rest framework**
```bash
'DEFAULT_AUTHENTICATION_CLASSES': [
'drf_easily_saas.auth.firebase.protect.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_sass/",
"name": "drf_easily_saas",
"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, Payment, Stripe",
"author": "Alexandre Meline",
"author_email": "alexandre.meline.dev@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/e6/dc/05af8af0aa5f6f8f3c53b408767cb56bc4c52cabe07f3eb777e84e3caf84/drf_easily_saas-0.0.2.tar.gz",
"platform": null,
"description": "# DRF Easily Saas\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_saas',\n]\n```\n\nAdd a Easily configuration\n\n```python\nEASILY= {\n 'auth_provider': 'firebase', #\u00a0Required\n 'payment_provider': 'stripe', #\u00a0Required\n 'frontend_url': 'http://localhost:3000', #\u00a0Required\n 'firebase_config': {\n 'import_users': True,\n \"hot_reload_import\": False,\n 'config': {\n \"type\": \"service_account\",\n \"project_id\": \"o-380604\",\n \"private_key_id\": \"7b9b5b20483ccbb91e\",\n \"private_key\": \"-----BEGIN PRIVATE KEY-----\\nMIIEvAIBADANAQEFAASCBKYwggSiAgEAAoIBAQC1Mv+HbJi7ObeG\\nLGAhYXS7gf+O+9gMPYQWgM6KZqvd2dhvuqxyzqJYttz5o55YKBZTFDdY5Kped51f\\nU273RylDA6\\nWsbW9xyvgmVpbIbja29Lhc1H1Hymd4edFfDdee/d9LTF8g8QNHJ5LFx\\n0DvORqNuNh0rM78sQS9l+g9PNdCoBTWxXE8BRvUCgYB2PXGAGCVDeesKxDyR3hwj\\nVxR0un/5KMjJgpChhPBwNFLtar6WrgQVMYZomCwh9xjTAh/69lxtzaxJ+mvz3A8X\\n1waeyUrsd+aBviq0Yz/6JVDghOkY5ZrptcR3Dg0hHLkEg0QLixmWebUQnZ6knW7z\\n38m94Msowc2s2N6uYVE63g==\\n-----END PRIVATE KEY-----\\n\",\n \"client_email\": \"firebase-adminsdk-i7799@oting-380604.iam.gserviceaccount.com\",\n \"client_id\": \"106479259625371201589\",\n \"auth_uri\": \"https://accounts.google.com/o/oauth2/auth\",\n \"token_uri\": \"https://oauth2.googleapis.com/token\",\n \"auth_provider_x509_cert_url\": \"https://www.googleapis.com/oauth2/v1/certs\",\n \"client_x509_cert_url\": \"https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-i7799%-380604.iam.gserviceaccount.com\",\n \"universe_domain\": \"googleapis.com\"\n },\n },\n 'stripe_config': {\n 'public_key': os.getenv('STRIPE_PUBLIC_KEY'),\n 'secret_key': os.getenv('STRIPE_SECRET_KEY'),\n 'webhook_verif_strategy': 'apikey',\n 'subscription': {\n 'payment_method_types': ['card', 'paypal'],\n 'billing_address_collection': 'auto',\n 'shipping_address_collection': {\n 'allowed_countries': ['US', 'CA', 'FR'],\n },\n 'automatic_tax': {'enabled': True},\n },\n },\n}\n```\n\n\n**Configure custom Firebase authentication in rest framework**\n\n```bash\n'DEFAULT_AUTHENTICATION_CLASSES': [\n 'drf_easily_saas.auth.firebase.protect.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 is complete tools for sass building",
"version": "0.0.2",
"project_urls": {
"Homepage": "https://github.com/alexandre-meline/drf_easily_sass/"
},
"split_keywords": [
"django",
" firebase",
" authentication",
" user synchronization",
" drf",
" python",
" user management",
" security",
" api",
" json web tokens",
" payment",
" stripe"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "006da54a778e614466eb69d07c8eeb584f0e1c7b5e39a59dde6c8606fd984236",
"md5": "1e00320502b1141eb69264accdfdf3ef",
"sha256": "65fc77d6162bd552e4eb23fc2406392274c5eedb4ce356bc58a9835f5ef8c930"
},
"downloads": -1,
"filename": "drf_easily_saas-0.0.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1e00320502b1141eb69264accdfdf3ef",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.10",
"size": 26123,
"upload_time": "2024-04-29T23:34:12",
"upload_time_iso_8601": "2024-04-29T23:34:12.571295Z",
"url": "https://files.pythonhosted.org/packages/00/6d/a54a778e614466eb69d07c8eeb584f0e1c7b5e39a59dde6c8606fd984236/drf_easily_saas-0.0.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "e6dc05af8af0aa5f6f8f3c53b408767cb56bc4c52cabe07f3eb777e84e3caf84",
"md5": "0bb6d96b8df39a20665935c9204945f4",
"sha256": "bb0521d717a510d59b99071c274b41b19d4af0894a9389b576350f7d42a4f85e"
},
"downloads": -1,
"filename": "drf_easily_saas-0.0.2.tar.gz",
"has_sig": false,
"md5_digest": "0bb6d96b8df39a20665935c9204945f4",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.10",
"size": 17149,
"upload_time": "2024-04-29T23:34:14",
"upload_time_iso_8601": "2024-04-29T23:34:14.835676Z",
"url": "https://files.pythonhosted.org/packages/e6/dc/05af8af0aa5f6f8f3c53b408767cb56bc4c52cabe07f3eb777e84e3caf84/drf_easily_saas-0.0.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-04-29 23:34:14",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "alexandre-meline",
"github_project": "drf_easily_sass",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "drf_easily_saas"
}