0

I'm using particle.io for an application and I have the webhook working fine to the Realtime database using the database secret.

I'm making some updates and I want to start using the firestore database but the database secret does not work, I keep getting 403 not authorized when I add the database secret to my call.

Is there a way I can use the particle.io with the firebase admin SDK? On my firestore rule I have the following, so only authorized account can access the data.

service cloud.firestore {
    match /databases/{database}/documents {
       match /{document=**} {
          allow read, write: if request.auth != null;
       }
    }
}

This is the URL I'm using to post from the webhook.

https://firestore.googleapis.com/v1beta1/projects/{projectId}/databases/(default)/documents/{documentName}?key={databasescret}

I go the URL from the API Explorer on firebase, but they use OAUTH and it was working fine with OAUTH, it just that I do not OAUTH option from the particle.io webhook.

Ennio
  • 1,147
  • 2
  • 17
  • 34

1 Answers1

0

Unfortunately Particle webhooks can't authenticate using OAuth (by default only HTTP Basic Auth is supported). There's a deprecated feature of Database Secrets (Rick Kaseguma wrote a great tutorial about it.) but they will be retired at some point.

Seems like a replacement of secrets would be Firebase ID token for which you need to create an user and retrieve the ID token for this user.

suda
  • 2,604
  • 1
  • 27
  • 38