DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,673 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Thai Pangsakulyanont
Thai Pangsakulyanont

Posted on

Import/export data into/from Firebase Realtime Database from your terminal using HTTPie and Google Cloud SDK

Sometimes you want to upload some JSON data to Firebase Realtime Database. Usually this means generating a service account and writing a script that uses Firebase SDK to upload that data.

However, Firebase Realtime Database REST API supports Google OAuth2 access tokens.

If you installed Google Cloud SDK, such token can be generated using the following command:

gcloud auth print-access-token

The access token has access to all projects you own which makes this very convenient. That means you can now do this:

cat FILE.json | \
  http put https://PROJECT.firebaseio.com/REF.json \
    "Authorization: Bearer $(gcloud auth print-access-token)"

Top comments (0)

Take a look at this:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. πŸ›