Authentication

To use FireO you first need to connect it with Google Firestore

Table of contents

  1. Google Cloud Platform
  2. Local Development
  3. Service Account
  4. Explicit Credentials
  5. Read more

Read more about How to authenticate FireO.

Google Cloud Platform

If you’re running in Compute Engine or App Engine, authentication should “just work”.

Local Development

If you’re developing locally, the easiest way to authenticate is using the Google Cloud SDK

$ gcloud auth application-default login

Note that this command generates credentials for client libraries. To authenticate the CLI itself, use

$ gcloud auth login

Previously, gcloud auth login was used for both use cases. If your gcloud installation does not support the new command, please update it

$ gcloud components update

Service Account

If you’re running your application elsewhere, you should download a service account JSON keyfile and point to it using an environment variable

$ export GOOGLE_APPLICATION_CREDENTIALS="/path/to/keyfile.json"

or you can pass JSON file in FireO connection

fireo.connection(from_file="/path/to/keyfile.json")

Explicit Credentials

The Application Default Credentials discussed above can be useful if your code needs to run in many different environments or if you just don’t want authentication to be a focus in your code.

However, you may want to be explicit because

  • your code will only run in one place
  • you may have code which needs to be run as a specific service account every time (rather than with the locally inferred credentials)
  • you may want to use two separate accounts to simultaneously access data from different projects

In these situations, you can create an explicit Credentials object suited to your environment. After creation, you can pass it directly to a Connection

fireo.connection(credentials=credentials)

Read more

Read more about How to authenticate FireO.