0

I have a project that creates GCP and adds firebase resources via API. In addition, I need to create a user using admin SDK, but in order to use it I need to initialize my firebase admin using - firebase_admin.initialize_app(cred).

I'm using the following API projects.getAdminSdkConfig in order to get the project details to initialize it via the admin SDK but I not sure how to use the response.

Link to Google docs: https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects/getAdminSdkConfig

My respose from the API is: {'projectId': 'test-project-880459', 'storageBucket': 'test-project-880459.appspot.com'} How do I use it to initialize the admin SDK?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Kazavo
  • 71
  • 5

1 Answers1

0

I finally found it. The initialized app should get two parameters, the cred and the config json that received from the getSdkConfig API.

cred = credentials.Certificate(CREDENTIALS_KEY_PATH)
config = {authDomain: 'project-id.firebaseapp.com', projectId: 'project-id'}
firebase_admin.initialize_app(cred, config)
Kazavo
  • 71
  • 5