garyburgmann / drf-firebase-auth

Firebase backend to receive a user idToken and authenticate via Django REST Framework 'authentication.BaseAuthentication'. Optionally, a new local user can be created in the process.
MIT License
128 stars 62 forks source link

No clear option/documentation for local/staging/production config management #9

Open sunweiyang opened 5 years ago

sunweiyang commented 5 years ago

Committing firebase.json to a repo should not be the way to deploy a Django server (I have a Heroku Django app, and committing that file is the only way I can use drf-firebase-auth as it exists today). There should be a way to set the contents of firebase.json as an environment variable.

sherzberg commented 4 years ago

@sunweiyang I also didn't want to commit the file or put the file on the filesystem so I dug a little bit and found out that the way drf-firebase-auth sets up the firebase_admin credentials is pretty generic and you can just set the value of FIREBASE_SERVICE_ACCOUNT_KEY to a dict: https://github.com/firebase/firebase-admin-python/blob/master/firebase_admin/credentials.py#L84

So in my code I'm just reading in the json from a secret manager (I happen to be using AWS Secrets Manager), but if you have access to some cloud storage or secret manager, you could just read in the json yourself and parse it to a dict.

Maybe this could be documented?