[Answered ]-Python Firebase Admin SDK, Illegal Firebase credential provided

1πŸ‘

βœ…

I found the solution that worked for me on a comment on this post:Initializing Firebase Admin via Environment Variables without storing serviceAccount.json

Basically I stored all the firebase credentials json in one .env variable (it should be in one line) and used it like this:


from dotenv import load_dotenv

load_dotenv()  # take environment variables from .env.


firebaseConfig = json.loads(os.getenv("FIREBASE_CREDENTIALS", "{}"))


class FCMController:
    def __init__(self):
        if not firebase_admin._apps:  # check if firebase_admin is initialized
            firebase_admin.initialize_app(
                credential=credentials.Certificate(firebaseConfig))
πŸ‘€B. Mohammad

Leave a comment