firebase / firebase-admin-node

Firebase Admin Node.js SDK
https://firebase.google.com/docs/admin/setup
Apache License 2.0
1.63k stars 371 forks source link

App Check 'Missing appcheck token' error when performing RTDB operations #1788

Open lahirumaramba opened 2 years ago

lahirumaramba commented 2 years ago

Can reproduce on firebase-admin@10.3.0 and up.

└─┬ firebase-admin@10.3.0
  └─┬ @firebase/database-compat@0.2.2
    └── @firebase/database@0.13.2

Internal issue: b/236414557

lahirumaramba commented 2 years ago

Fix: https://github.com/firebase/firebase-js-sdk/pull/6399

Faizan770gp commented 2 years ago

@lahirumaramba I have followed documented steps to setup recaptcha and use AppCheck with flutter. I've enabled enforcements for cloud Firestore but after enabling enforcements I'm getting the following error.

[cloud_firestore/permission-denied] Missing or insufficient permissions.

lahirumaramba commented 2 years ago

Hi @Faizan770gp are you using the Firebase Admin SDK or Firebase Client SDKs? If you are using Firebase client SDKs and getting the above error, it might be due to how your security rules are set. You can check your existing rules at Go to Database -> Rules : on the Firebase console. In the future please use this repo for Firebase Admin SDK SDK related questions. Thanks!

Faizan770gp commented 2 years ago
rules_version = '2';
service cloud.firestore {
  match /databases/{database}/documents {
    match /{document=**} {
      allow read, write: if true;
    }
  }
}

My database rules are set to true in all conditions. So the rules are not the problem here.

weixifan commented 2 years ago

Hi @Faizan770gp -- thank you for bringing your issue to our attention. The issue you experienced with Flutter and Firestore may be related to a similar issue we recently fixed. Could you please try updating to the latest Flutter App Check version and see if that fixes your issue?