alekcz / datahike-firebase

Datahike with Firebase as data storage
Eclipse Public License 2.0
50 stars 0 forks source link

What's the format of GOOGLE_APPLICATION_CREDENTIALS :env key? #1

Closed nfedyashev closed 4 years ago

nfedyashev commented 4 years ago

Hi Alexander!

I wanted to give datahike-firebase a try but I was a bit confused with the README example, most probably because of my lack of Firebase experience.

I guess that if this line could be explained in a bit more details:

:env "GOOGLE_APPLICATION_CREDENTIALS" ;environment variable with services account details

this could be much easier for new users of datahike-firebase.

alekcz commented 4 years ago

@nfedyashev Hi, firebase stores the credentials in a json file. And generally you have to read it in. I wrote a helper lib to read it in from an environment variable. I've documented the instructions https://github.com/alekcz/google-credentials.

  1. Download the credentials from firebase in Settings: Screenshot 2020-06-21 at 18 53 25

The file will be in the format below, then you copy the file contents in to the environment variable.

{
  "type": "",
  "project_id": "",
  "private_key_id": "",
  "private_key": "-----BEGIN PRIVATE KEY-----\n\n-----END PRIVATE KEY-----\n",
  "client_email": "firebase-...@s....gserviceaccount.com",
  "client_id": "",
  "auth_uri": "https://accounts.google.com/o/oauth2/auth",
  "token_uri": "https://oauth2.googleapis.com/token",
  "auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
  "client_x509_cert_url": ""
}

Thanks for the issue. I'll update the readme to be more explicit. Lemme know if you come right.

nfedyashev commented 4 years ago

Thank you so much!