dunyakirkali
dunyakirkali

Reputation: 389

How to make a call to Firestore using gRPC

I'm trying to build a gRPC client for Google's Firestore API in Elixir.

Before starting to write some code , I thought that it would be wise to first start with BloomRPC in order to debug the issue.

enter image description here

As base url, I'm using https://firestore.googleapis.com where I pinned the rot certificate.

As auth I'm using an access_token obtained using oauth with the following 2 scopes: "https://www.googleapis.com/auth/cloud-platform https://www.googleapis.com/auth/datastore" being passed as a Authorization header:

{
    "Authorization": "Bearer 29ya.a0AfH6SMBDYZPsVgQv0PMqyGRXypc3DfWF_2jbvAJKMquTaryCvxEB7X1Rbprfk1Ebrwid2bXbcR3Aw-d1Tytlo_lThkyqRDRIbnSz5-nQ3xWklkmjyFMAuQtFCoz01hk3vbgBwd2gdbFNNWiOU_8NqPC_vElyz2-cQ34"
}

And I get back:

{
  "error": "3 INVALID_ARGUMENT: Missing required project ID."
}

So clearly I should be passing the project ID somehow but I can't find it anywhere in the docs. Anybody any clues?

Upvotes: 1

Views: 1069

Answers (1)

dunyakirkali
dunyakirkali

Reputation: 389

I just figured out what I was doing wrong.

Basically the Bearer token I was using is correct (obtained via the OAuth Playground).

The trick was to specify the PROJECT_ID in the parent parameter of the request:

{
  "parent": "projects/[project-id]/databases/(default)/documents",
  "page_size": 10
}

I should have just read the docs properly :)

Upvotes: 2

Related Questions