It’s almost never a good idea store the service account json file alongside code. Note that my example does not use a service account JSON at all. The service account json is only used for local testing, and never gets deployed. You should use application default credentials, like shown in the example.

firebase_admin.initialize_app(options={    
'databaseURL': 'https://<DB_NAME>.firebaseio.com',
})

Written by

Software engineer at Google. Enjoys working at the intersection of cloud, mobile and programming languages. Fan of all things tech and open source.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store