Firebase Permission Denied with Pyrebase library

后端 未结 2 831
迷失自我
迷失自我 2020-12-21 03:14

I have setup a Firebase account and a database.

I have copied the config with the API key into my Python code.

I still get a 401 Permission denied error on P

2条回答
  •  春和景丽
    2020-12-21 03:28

    I ran into this same issue trying to upload data to the database. I reread the beginning of: https://github.com/thisbejim/Pyrebase/blob/master/README.md

    import pyrebase
    
    config = {
      "apiKey": "apiKey",
      "authDomain": "projectId.firebaseapp.com",
      "databaseURL": "https://databaseName.firebaseio.com",
      "storageBucket": "projectId.appspot.com",
      "serviceAccount": "path/to/serviceAccountCredentials.json"
    }
    
    firebase = pyrebase.initialize_app(config)
    

    Add the serviceAccount entry into the configuration with a path to a key that you can download from Firebase.

    To get there: Settings > Project Settings > Service Accounts > Generate New Private Key.

    Put that key in some desired location and put that location in the "serviceAccount" path.

    Hope it helps.

提交回复
热议问题