Is there any way to upload the Credential File to the Firebase and only pass a path for this file from firebase to authenticate.
For Example:
here I need to pass the credential file which is in my local computer I need to pass a path from the internet maybe by uploading the credential file “serviceAccountKey.json” to the firebase and get a Url which include the path of this file on the internet.
JavaScript
x
2
1
cred = credentials.Certificate("path/to/serviceAccountKey.json")
2
Thanks.
Advertisement
Answer
I Solved This issue Instead of Generating a URL Which include the Path of the Json Credentials File and it won’t be secure I solved it by Creating a New Json File then passing the name of the New Json File to the Credentials File Path It Works:
JavaScript
1
17
17
1
firebase_credentials = {
2
"type": "",
3
"project_id": "",
4
"private_key_id": "",
5
"private_key": "-----BEGIN PRIVATE KEY-----
6
-----END PRIVATE KEY-----n",
7
"client_email": "",
8
"client_id": "",
9
"auth_uri": "",
10
"token_uri": "",
11
"auth_provider_x509_cert_url": "",
12
"client_x509_cert_url": ""
13
}
14
with open("firebase_credentials.json", "w") as write_file:
15
json.dump(firebase_credentials, write_file)
16
cred_obj = firebase_admin.credentials.Certificate('firebase_credentials.json')
17
And That’s It GOOD LUCK…