Skip to content

[cloud_firestore] Cloud Firestore for WEB throwing FirebaseError: Missing or insufficient permissions. (permission-denied)  #3095

@eduardothiesen

Description

@eduardothiesen

Describe the bug
I'm unable to access the Cloud Firestore database on Web (it works perfectly on Android and iOS) and used to work in previous versions on web too.

I tried in channels Dev and Beta, and tested using specific version in the beta channel 1.15.17

I also tried modifying the permissions on Cloud Firestore Rules directly (accepting all requests) but it did not work.

To Reproduce
Steps to reproduce the behavior:

  1. Run flutter project with firebase_auth and cloud_firestore for web
  2. Login in the application
  3. Request any data using the logged user to firestore
  4. See the error: FirebaseError: Missing or insufficient permissions. (permission-denied)

Expected behavior
Request returns the data

Additional context
My pubspec.yaml (Using cloud_firestore bellow 0.13 keeps loading firestore requests forever)

name: my_companies_manager
description: A new Flutter project.
version: 1.0.0+1

environment:
  sdk: ">=2.1.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  cupertino_icons: ^0.1.2
  firebase_core: 0.4.4+3
  firebase_auth: 0.15.5+2
  cloud_firestore: 0.13.4+2
  font_awesome_flutter: 8.7.0
  provider: 4.0.4
  mask_text_input_formatter: ^1.0.5
  connectivity: ^0.4.6+2
  device_info: ^0.4.1+4
  modal_progress_hud: ^0.1.3
  intl: ^0.16.1
  csv: ^4.0.3
  flutter_share: ^1.0.2+1
  path_provider: ^1.6.5
  autocomplete_textfield:

dev_dependencies:
  flutter_test:
    sdk: flutter
  uses-material-design: true

Index.html

<!DOCTYPE html>
<html>
<head>
  <meta charset="UTF-8">
  <meta content="IE=Edge" http-equiv="X-UA-Compatible">
  <meta name="description" content="A new Flutter project.">

  <!-- iOS meta tags & icons -->
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-status-bar-style" content="black">
  <meta name="apple-mobile-web-app-title" content="my_companies_manager">
  <link rel="apple-touch-icon" href="/icons/Icon-192.png">

  <title>my_companies_manager</title>
  <link rel="manifest" href="/manifest.json">
</head>
<body>
<script src="https://www.gstatic.com/firebasejs/7.9.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.9.1/firebase-firestore.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.9.1/firebase-auth.js"></script>
<script src="https://www.gstatic.com/firebasejs/7.9.1/firebase-storage.js"></script>
<!-- This script installs service_worker.js to provide PWA functionality to
     application. For more information, see:
     https://developers.google.com/web/fundamentals/primers/service-workers -->
<script>
    // TODO: Replace the following with your app's Firebase project configuration.
    // See: https://support.google.com/firebase/answer/7015592
    var firebaseConfig = {
      apiKey: "XXXXXX",
      authDomain: "example.firebaseapp.com",
      databaseURL: "https://example.firebaseio.com",
      projectId: "example",
      storageBucket: "exaple.appspot.com",
      messagingSenderId: "0000000000",
      appId: "1:45536682746:web:0000000f000000"
    };

    // Initialize Firebase
    firebase.initializeApp(firebaseConfig);
  </script>

<script>
    if ('serviceWorker' in navigator) {
      window.addEventListener('load', function () {
        navigator.serviceWorker.register('/flutter_service_worker.js');
      });
    }
  </script>
<script src="main.dart.js" type="application/javascript"></script>
</body>
</html>

Flutter doctor
Run flutter doctor and paste the output below:

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel unknown, v1.15.17, on Mac OS X 10.15.5 19F101, locale en-BR)
 
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.5)
[✓] Chrome - develop for the web
[✓] Android Studio (version 4.0)
[✓] Connected device (2 available)

• No issues found!

Thanks in advance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions